有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何更改通知横幅的方向?

我的DS桌面通知库有问题 在此库中,所有通知横幅都具有从左到右的方向 我想将这些通知的方向从LTR更改为RTL (图标大多位于横幅的右侧,标题和消息也需要从横幅的右侧开始。) 在这个图书馆我怎么做? https://i.imgur.com/uTlOpqs.png“截图”

我试着用“applycomponentation”作为框架,但它不起作用

    private static class DesktopLayoutFrame extends JDialog {
    Image bg;
    boolean nativeTrans;

    boolean finished=true;
    boolean clicked=false;

    public DesktopLayoutFrame() {
        super((JFrame)null,"DesktopLayoutFrame");
        setUndecorated(true);
        nativeTrans=Utils.isTranslucencySupported();
        setBackground(new Color(0,0,0,nativeTrans? 0:255));
        setContentPane(new JComponent(){
            @Override
            public void paintComponent(Graphics g){
                render((Graphics2D)g);
            }
        });
        addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent evt){
                clicked=true;
            }
        });
        setFocusableWindowState(false);
        setAlwaysOnTop(true);
        System.out.println("Desktop Notify Frame deployed.");
    }

    @Override
    public void setVisible(boolean visible) {
        boolean bool=isVisible();
        if (visible) {
            Rectangle screenSize = Utils.getScreenSize();
            setBounds(screenSize.x+screenSize.width-310, screenSize.y,
                      305, screenSize.height-5);
            if (!bool && !nativeTrans)
                bg=Utils.getBackgroundCap(getBounds());
        }
        super.setVisible(visible);
    }

    /**
     * Paints the window contents.
     * @param rd a graphics2D object received from the original paint event.
     */
    public void render(Graphics2D rd) {
        Point p = getMousePosition();
        finished = false;
        int x = 0, y = getHeight();
        long l = System.currentTimeMillis();
        if (windows.isEmpty()) finished = true;
        int cur = Cursor.DEFAULT_CURSOR;
        if (!nativeTrans) rd.drawImage(bg, 0, 0, this);
        for (int i = 0; i < windows.size(); i++) {
            DesktopNotify window = windows.get(i);
            if (window.isVisible()) {
                y -= window.h;
                if (window.popupStart == 0) {
                    window.popupStart = System.currentTimeMillis();
                }
                if (y > 0) {
                    boolean hover = false;
                    if (p != null) {
                        if (p.y > y && p.y < y + window.h) {
                            hover = true;
                            if (window.getAction() != null) {
                                cur = Cursor.HAND_CURSOR;
                            }
                            if (clicked) {
                                if (window.getAction() != null) {
                                    final DesktopNotify w = window;
                                    final long lf = l;
                                    java.awt.EventQueue.invokeLater(new Runnable(){@Override public void run(){
                                        w.getAction().actionPerformed(new ActionEvent(w, ActionEvent.ACTION_PERFORMED, "fireAction", lf, 0));
                                    }});
                                }
                                if (window.expTime() == Long.MAX_VALUE) {
                                    window.timeOut = l - window.popupStart + 500;
                                }
                            }
                        }
                    }
                    window.render(x, y, hover, rd, l);
                    if (window.markedForHide) {
                        window.timeOut = l - window.popupStart + 500;
                        window.markedForHide = false;
                    }
                } else {
                    window.popupStart = l;
                }
                if (l > window.expTime() || (y <= 0 && window.markedForHide)) {
                    window.markedForHide = false;
                    window.setVisible(false);
                    windows.remove(window);
                    i--;
                }
                y -= 5;
            }
        }
        clicked = false;
        setCursor(new Cursor(cur));
    }
}

我认为“DesktopNotifyDriver.java”中的上述代码必须为此进行编辑。对不起我的英语 请帮我渡过难关


共 (0) 个答案