use of javax.swing.JRootPane in project ACS by ACS-Community.
the class LogMonitorFrame method initialize.
/**
* Init the GUI
*/
private void initialize() {
setTitle("ACS logs monitor");
JRootPane rootP = getRootPane();
rootP.setLayout(new BorderLayout());
// Add the tabs
tabbedPnl = new JTabbedPane();
totalStatsPnl = new TotalStatisticsPnl();
tabbedPnl.add("Values", totalStatsPnl);
trendPnl = new TrendPnl();
tabbedPnl.add("Trend", trendPnl);
rootP.add(tabbedPnl, BorderLayout.CENTER);
// Add the close button at the bottom
JPanel btnPnl = new JPanel(new FlowLayout(FlowLayout.CENTER));
btnPnl.add(closeBtn);
closeBtn.addActionListener(this);
rootP.add(btnPnl, BorderLayout.SOUTH);
pack();
setVisible(true);
}
use of javax.swing.JRootPane in project ACS by ACS-Community.
the class ErrorLogDialog method initGUI.
/**
* Builds the content of the GUI
*
*/
private void initGUI() {
ImageIcon icon = new ImageIcon(LogTypeHelper.class.getResource("/errorLogIcon.png"));
setIconImage(icon.getImage());
synchronized (logTA) {
logTA.setDocument(document);
logTA.setEditable(false);
}
JScrollPane logSP = new JScrollPane(logTA);
JRootPane mainPnl = this.getRootPane();
mainPnl.setLayout(new BorderLayout());
mainPnl.add(logSP, BorderLayout.CENTER);
// Close button
JPanel btnPnl = new JPanel(new FlowLayout());
closeBtn = new JButton("Close");
closeBtn.addActionListener(this);
btnPnl.add(closeBtn);
mainPnl.add(btnPnl, BorderLayout.SOUTH);
// Build the toolbar
toolBar = new JToolBar();
JPanel toolBarPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
ImageIcon cleanIcon = new ImageIcon(ErrorLogDialog.class.getResource("/delete.png"));
cleanAllBtn = new JButton("<HTML><Font size=\"-1\">Clean</FONT></HTML>", cleanIcon);
cleanAllBtn.addActionListener(this);
cleanAllBtn.setToolTipText("Delete log");
ImageIcon saveIcon = new ImageIcon(ErrorLogDialog.class.getResource("/disk.png"));
saveAllBtn = new JButton("<HTML><Font size=\"-1\">Save</FONT></HTML>", saveIcon);
saveAllBtn.addActionListener(this);
saveAllBtn.setToolTipText("Save log");
toolBarPanel.add(cleanAllBtn);
toolBarPanel.add(saveAllBtn);
toolBar.add(toolBarPanel);
mainPnl.add(toolBar, BorderLayout.PAGE_START);
rationalizeButtons();
}
use of javax.swing.JRootPane in project adempiere by adempiere.
the class WindowMenu method expose.
public void expose() {
final JDialog dialog = new JDialog();
dialog.setSize(Toolkit.getDefaultToolkit().getScreenSize());
dialog.setUndecorated(true);
dialog.setModal(true);
//add escape to close
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
dialog.setVisible(false);
}
};
JRootPane jr = dialog.getRootPane();
KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
jr.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
//new Thread(new Loader(dialog)).start();
SwingUtilities.invokeLater(new Loader(dialog));
dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
dialog.setVisible(true);
}
use of javax.swing.JRootPane in project jdk8u_jdk by JetBrains.
the class InsetsEncapsulation method run.
@Override
public void run() {
runTest(new JLabel("hi"));
runTest(new JMenu());
runTest(new JTree());
runTest(new JTable());
runTest(new JMenuItem());
runTest(new JCheckBoxMenuItem());
runTest(new JToggleButton());
runTest(new JSpinner());
runTest(new JSlider());
runTest(Box.createVerticalBox());
runTest(Box.createHorizontalBox());
runTest(new JTextField());
runTest(new JTextArea());
runTest(new JTextPane());
runTest(new JPasswordField());
runTest(new JFormattedTextField());
runTest(new JEditorPane());
runTest(new JButton());
runTest(new JColorChooser());
runTest(new JFileChooser());
runTest(new JCheckBox());
runTest(new JInternalFrame());
runTest(new JDesktopPane());
runTest(new JTableHeader());
runTest(new JLayeredPane());
runTest(new JRootPane());
runTest(new JMenuBar());
runTest(new JOptionPane());
runTest(new JRadioButton());
runTest(new JRadioButtonMenuItem());
runTest(new JPopupMenu());
runTest(new JScrollBar());
runTest(new JScrollPane());
runTest(new JViewport());
runTest(new JSplitPane());
runTest(new JTabbedPane());
runTest(new JToolBar());
runTest(new JSeparator());
runTest(new JProgressBar());
if (!failures.isEmpty()) {
System.out.println("These classes failed");
for (final Component failure : failures) {
System.out.println(failure.getClass());
}
throw new RuntimeException("Test failed");
}
}
use of javax.swing.JRootPane in project JMRI by JMRI.
the class TrackSegment method editTrackSegment.
/**
* Edit a Track Segment.
*/
protected void editTrackSegment() {
if (editOpen) {
editTrackSegmentFrame.setVisible(true);
return;
}
// Initialize if needed
if (editTrackSegmentFrame == null) {
// key moved to DisplayBundle to be found by CircuitBuilder.java
editTrackSegmentFrame = new JmriJFrame(Bundle.getMessage("EditTrackSegment"), false, true);
editTrackSegmentFrame.addHelpMenu("package.jmri.jmrit.display.EditTrackSegment", true);
editTrackSegmentFrame.setLocation(50, 30);
Container contentPane = editTrackSegmentFrame.getContentPane();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
// add dashed choice
JPanel panel31 = new JPanel();
panel31.setLayout(new FlowLayout());
dashedBox.removeAllItems();
dashedBox.addItem(rb.getString("Solid"));
solidIndex = 0;
dashedBox.addItem(rb.getString("Dashed"));
dashedIndex = 1;
dashedBox.setToolTipText(rb.getString("DashedToolTip"));
panel31.add(new JLabel(rb.getString("Style") + " : "));
panel31.add(dashedBox);
contentPane.add(panel31);
// add mainline choice
JPanel panel32 = new JPanel();
panel32.setLayout(new FlowLayout());
mainlineBox.removeAllItems();
mainlineBox.addItem(rb.getString("Mainline"));
mainlineTrackIndex = 0;
mainlineBox.addItem(rb.getString("NotMainline"));
sideTrackIndex = 1;
mainlineBox.setToolTipText(rb.getString("MainlineToolTip"));
panel32.add(mainlineBox);
contentPane.add(panel32);
// add hidden choice
JPanel panel33 = new JPanel();
panel33.setLayout(new FlowLayout());
hiddenBox.setToolTipText(rb.getString("HiddenToolTip"));
panel33.add(hiddenBox);
contentPane.add(panel33);
// setup block name
JPanel panel2 = new JPanel();
panel2.setLayout(new FlowLayout());
JLabel blockNameLabel = new JLabel(rb.getString("BlockID"));
panel2.add(blockNameLabel);
layoutEditor.setupComboBox(blockNameComboBox, false, true);
blockNameComboBox.setToolTipText(rb.getString("EditBlockNameHint"));
panel2.add(blockNameComboBox);
contentPane.add(panel2);
if (getArc() && circle) {
JPanel panel20 = new JPanel();
panel20.setLayout(new FlowLayout());
JLabel arcLabel = new JLabel("Set Arc Angle");
panel20.add(arcLabel);
panel20.add(arcField);
arcField.setToolTipText("Set Arc Angle");
contentPane.add(panel20);
arcField.setText("" + getAngle());
}
// set up Edit Block, Done and Cancel buttons
JPanel panel5 = new JPanel();
panel5.setLayout(new FlowLayout());
// Edit Block
panel5.add(segmentEditBlock = new JButton(Bundle.getMessage("EditBlock", "")));
segmentEditBlock.addActionListener((ActionEvent e) -> {
segmentEditBlockPressed(e);
});
// empty value for block 1
segmentEditBlock.setToolTipText(Bundle.getMessage("EditBlockHint", ""));
panel5.add(segmentEditDone = new JButton(Bundle.getMessage("ButtonDone")));
segmentEditDone.addActionListener((ActionEvent e) -> {
segmentEditDonePressed(e);
});
segmentEditDone.setToolTipText(Bundle.getMessage("DoneHint", Bundle.getMessage("ButtonDone")));
// make this button the default button (return or enter activates)
// Note: We have to invoke this later because we don't currently have a root pane
SwingUtilities.invokeLater(() -> {
JRootPane rootPane = SwingUtilities.getRootPane(segmentEditDone);
rootPane.setDefaultButton(segmentEditDone);
});
// Cancel
panel5.add(segmentEditCancel = new JButton(Bundle.getMessage("ButtonCancel")));
segmentEditCancel.addActionListener((ActionEvent e) -> {
segmentEditCancelPressed(e);
});
segmentEditCancel.setToolTipText(Bundle.getMessage("CancelHint", Bundle.getMessage("ButtonCancel")));
contentPane.add(panel5);
}
// Set up for Edit
if (mainline) {
mainlineBox.setSelectedIndex(mainlineTrackIndex);
} else {
mainlineBox.setSelectedIndex(sideTrackIndex);
}
if (dashed) {
dashedBox.setSelectedIndex(dashedIndex);
} else {
dashedBox.setSelectedIndex(solidIndex);
}
hiddenBox.setSelected(hidden);
blockNameComboBox.getEditor().setItem(blockName);
editTrackSegmentFrame.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
segmentEditCancelPressed(null);
}
});
editTrackSegmentFrame.pack();
editTrackSegmentFrame.setVisible(true);
editOpen = true;
}
Aggregations