Search in sources :

Example 11 with JLayeredPane

use of javax.swing.JLayeredPane in project lotro-companion by dmorcellet.

the class EquipmentPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(null);
    _layeredPane = new JLayeredPane();
    panel.add(_layeredPane, BorderLayout.CENTER);
    Dimension d = computeDimensions();
    panel.setPreferredSize(d);
    panel.setMinimumSize(d);
    _layeredPane.setSize(d);
    MouseListener listener = buildRightClickListener();
    for (EQUIMENT_SLOT slot : EQUIMENT_SLOT.values()) {
        // Position for item
        Dimension position = _iconPositions.get(slot);
        // Add object icon
        // - icon controller
        EquipmentSlotIconController iconController = new EquipmentSlotIconController(slot);
        _icons.put(slot, iconController);
        ImageIcon icon = iconController.getIcon();
        // - button
        JButton button = new JButton(icon);
        button.setBorderPainted(false);
        button.setMargin(new Insets(0, 0, 0, 0));
        button.setBounds(position.width, position.height, ICON_SIZE, ICON_SIZE);
        _layeredPane.add(button, ICONS_DEPTH);
        _buttons.put(slot, button);
        button.setActionCommand(SLOT_SEED + slot.name());
        button.addActionListener(this);
        button.addMouseListener(listener);
        button.setToolTipText("");
    }
    updateIcons();
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) MouseListener(java.awt.event.MouseListener) Insets(java.awt.Insets) EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT) JLayeredPane(javax.swing.JLayeredPane) JButton(javax.swing.JButton) Dimension(java.awt.Dimension)

Example 12 with JLayeredPane

use of javax.swing.JLayeredPane in project blue by kunstmusik.

the class ScoreMouseListener method mouseMoved.

@Override
public void mouseMoved(MouseEvent e) {
    if (e.isConsumed() || ModeManager.getInstance().getMode() != ScoreMode.SCORE) {
        return;
    }
    ScoreObjectView sObjView = scoreTC.getScoreObjectViewAtPoint(e);
    final JLayeredPane scorePanel = scoreTC.getScorePanel();
    Collection<? extends ScoreObject> selectedObjects = scoreTC.getLookup().lookupAll(ScoreObject.class);
    // FIXME - perhaps optimize the lookup to cache results using lookup listener
    if (sObjView != null && selectedObjects.size() == 1 && selectedObjects.contains(sObjView.getScoreObject())) {
        Point p = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), (JComponent) sObjView);
        JComponent comp = (JComponent) sObjView;
        if (p.x > 0 && p.x < EDGE) {
            scorePanel.setCursor(RIGHT_RESIZE_CURSOR);
        } else if (p.x > comp.getWidth() - EDGE && p.x <= comp.getWidth()) {
            scorePanel.setCursor(LEFT_RESIZE_CURSOR);
        } else {
            scorePanel.setCursor(MOVE_CURSOR);
        }
    } else {
        if (scorePanel.getCursor() != NORMAL_CURSOR) {
            scorePanel.setCursor(NORMAL_CURSOR);
        }
    }
}
Also used : JLayeredPane(javax.swing.JLayeredPane) JComponent(javax.swing.JComponent) Point(java.awt.Point)

Example 13 with JLayeredPane

use of javax.swing.JLayeredPane in project jo-client-platform by jo-source.

the class BeanRelationGraphImpl method initializeLayeredPane.

private Component initializeLayeredPane() {
    final JLayeredPane finalContainer = new JLayeredPane();
    nodeCountLabel = new JLabel(" NodeCount: " + getVisibleNodeCount() + " / " + maxNodeCount);
    nodeCountLabel.setBounds(display.getWidth() - (NODECOUNTLABEL_WIDTH + 1), display.getHeight() - (NODECOUNTLABEL_HEIGHT + 1), NODECOUNTLABEL_WIDTH, NODECOUNTLABEL_HEIGHT);
    nodeCountLabel.setBorder(BorderFactory.createEtchedBorder(Color.black, Color.lightGray));
    nodeCountLabel.setOpaque(true);
    finalContainer.add(display, new Integer(0), 0);
    finalContainer.add(nodeCountLabel, new Integer(1), 0);
    return finalContainer;
}
Also used : JLayeredPane(javax.swing.JLayeredPane) JLabel(javax.swing.JLabel)

Example 14 with JLayeredPane

use of javax.swing.JLayeredPane in project SKMCLauncher by SKCraft.

the class WebpagePanel method setPlaceholder.

private void setPlaceholder() {
    activated = false;
    JLayeredPane panel = new JLayeredPane();
    panel.setBorder(new CompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(4, 4, 4, 4)));
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    final JButton showButton = new JButton("Load page");
    showButton.setAlignmentX(Component.CENTER_ALIGNMENT);
    showButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            showButton.setVisible(false);
            setDocument();
            fetchAndDisplay(url);
        }
    });
    // Center the button vertically.
    panel.add(new Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(1000, 1000)));
    panel.add(showButton);
    panel.add(new Box.Filler(new Dimension(0, 0), new Dimension(0, 0), new Dimension(1000, 1000)));
    add(panel, BorderLayout.CENTER);
}
Also used : ActionListener(java.awt.event.ActionListener) JLayeredPane(javax.swing.JLayeredPane) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) CompoundBorder(javax.swing.border.CompoundBorder) Box(javax.swing.Box) Dimension(java.awt.Dimension)

Example 15 with JLayeredPane

use of javax.swing.JLayeredPane in project SKMCLauncher by SKCraft.

the class WebpagePanel method setDocument.

private void setDocument() {
    activated = true;
    JLayeredPane panel = new JLayeredPane();
    panel.setLayout(new WebpageLayoutManager());
    documentView = new JEditorPane();
    documentView.setEditable(false);
    documentView.addHyperlinkListener(new HyperlinkListener() {

        @Override
        public void hyperlinkUpdate(HyperlinkEvent e) {
            if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                if (e.getURL() != null) {
                    SwingHelper.openURL(e.getURL(), self);
                }
            }
        }
    });
    JScrollPane scrollPane = new JScrollPane(documentView);
    panel.add(scrollPane, new Integer(1));
    progressBar = new JProgressBar();
    progressBar.setIndeterminate(true);
    panel.add(progressBar, new Integer(2));
    add(panel, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) HyperlinkEvent(javax.swing.event.HyperlinkEvent) HyperlinkListener(javax.swing.event.HyperlinkListener) JLayeredPane(javax.swing.JLayeredPane) JEditorPane(javax.swing.JEditorPane) JProgressBar(javax.swing.JProgressBar)

Aggregations

JLayeredPane (javax.swing.JLayeredPane)16 Component (java.awt.Component)6 JButton (javax.swing.JButton)6 JComponent (javax.swing.JComponent)5 Dimension (java.awt.Dimension)4 JPanel (javax.swing.JPanel)4 JEditorPane (javax.swing.JEditorPane)3 JMenuBar (javax.swing.JMenuBar)3 JRootPane (javax.swing.JRootPane)3 Dialog (java.awt.Dialog)2 Frame (java.awt.Frame)2 Insets (java.awt.Insets)2 ArrayList (java.util.ArrayList)2 JCheckBox (javax.swing.JCheckBox)2 JCheckBoxMenuItem (javax.swing.JCheckBoxMenuItem)2 JColorChooser (javax.swing.JColorChooser)2 JDesktopPane (javax.swing.JDesktopPane)2 JDialog (javax.swing.JDialog)2 JFrame (javax.swing.JFrame)2 JLabel (javax.swing.JLabel)2