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;
}
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);
}
}
}
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;
}
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);
}
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);
}
Aggregations