Search in sources :

Example 1 with JRootPane

use of javax.swing.JRootPane in project languagetool by languagetool-org.

the class LanguageManagerDialog method show.

public void show() {
    dialog = new JDialog(owner, true);
    dialog.setTitle(messages.getString("guiLanguageManagerDialog"));
    // close dialog when user presses Escape key:
    // TODO: taken from ConfigurationDialog, avoid duplication:
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    ActionListener actionListener = new ActionListener() {

        @Override
        @SuppressWarnings("unused")
        public void actionPerformed(ActionEvent actionEvent) {
            dialog.setVisible(false);
        }
    };
    JRootPane rootPane = dialog.getRootPane();
    rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    Container contentPane = dialog.getContentPane();
    contentPane.setLayout(new GridBagLayout());
    list = new JList<>(ruleFiles.toArray(new File[ruleFiles.size()]));
    GridBagConstraints cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 2.0f;
    cons.weighty = 2.0f;
    contentPane.add(new JScrollPane(list), cons);
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.fill = GridBagConstraints.HORIZONTAL;
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    addButton = new JButton(messages.getString("guiAddButton"));
    addButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 0;
    buttonPanel.add(addButton, cons);
    removeButton = new JButton(messages.getString("guiRemoveButton"));
    removeButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 1;
    buttonPanel.add(removeButton, cons);
    closeButton = new JButton(messages.getString("guiCloseButton"));
    closeButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 2;
    buttonPanel.add(closeButton, cons);
    cons.gridx = 1;
    cons.gridy = 0;
    cons = new GridBagConstraints();
    cons.anchor = GridBagConstraints.NORTH;
    contentPane.add(buttonPanel, cons);
    dialog.pack();
    dialog.setSize(300, 200);
    dialog.setLocationByPlatform(true);
    dialog.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) JDialog(javax.swing.JDialog)

Example 2 with JRootPane

use of javax.swing.JRootPane in project ACS by ACS-Community.

the class ExpertPrefsDlg method initGUI.

/**
	 * Builds the GUI
	 *
	 */
private void initGUI() {
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    /////////////////////////////////////////////////////////////
    // Add the table constraints (max num of logs and time frame)
    ///////////////////////////////////////////////////////////
    JPanel tablePnl = new JPanel();
    tablePnl.setBorder(BorderFactory.createTitledBorder("Table constraints"));
    tablePnl.setLayout(new GridBagLayout());
    GridBagConstraints constr = new GridBagConstraints();
    // Num of logs
    constr.gridx = 0;
    constr.gridy = 0;
    constr.fill = GridBagConstraints.HORIZONTAL;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.MAX_NUM_OF_LOGS.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    constr.fill = GridBagConstraints.HORIZONTAL;
    tablePnl.add(maxLogsInTableCB, constr);
    // Time frame
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.WEST;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(OptionWidgets.TIME_FRAME.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    tablePnl.add(timeFrameCB, constr);
    /// DISABLED
    timeFrameCB.setEnabled(false);
    // DISABLED
    OptionWidgets.TIME_FRAME.enableCB.setEnabled(false);
    ///////////////////////////////////////////////////////////
    // Add engine constraints
    ///////////////////////////////////////////////////////////
    JPanel enginePnl = new JPanel();
    enginePnl.setBorder(BorderFactory.createTitledBorder("Engine constraints"));
    enginePnl.setLayout(new GridBagLayout());
    // INPUT RATE
    constr.gridx = 0;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_INPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 0;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(inputRateTF, constr);
    // Output RATE
    constr.gridx = 0;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.MAX_OUTPUT_RATE.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 1;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(outputRateTF, constr);
    // DYNAMIC DISCARD LEVEL
    JPanel pnl = new JPanel();
    pnl.setLayout(new GridLayout(3, 2));
    pnl.add(new JLabel("Threshold: "), "1");
    pnl.add(dynThresholdTF, "2");
    pnl.add(new JLabel("Damping: "), "3");
    pnl.add(dynDampingTF, "4");
    pnl.add(new JLabel("Time: "), "5");
    pnl.add(dynIntervalTF, "6");
    constr.gridx = 0;
    constr.gridy = 2;
    constr.fill = GridBagConstraints.VERTICAL;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(OptionWidgets.DYNAMIC_DISCARD_LEVEL.enableCB, constr);
    constr.gridx = 1;
    constr.gridy = 2;
    constr.anchor = GridBagConstraints.LAST_LINE_START;
    constr.insets = new Insets(5, 5, 5, 5);
    enginePnl.add(pnl, constr);
    // Add the table and engine panels to the main panel
    mainPnl.add(tablePnl, BorderLayout.CENTER);
    mainPnl.add(enginePnl, BorderLayout.NORTH);
    // Add the OK, CANCEL buttons
    JPanel buttonsPnl = new JPanel(new BorderLayout());
    JPanel okCancelPnl = new JPanel();
    okCancelPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    BoxLayout boxLayout = new BoxLayout(okCancelPnl, BoxLayout.LINE_AXIS);
    okCancelPnl.setLayout(boxLayout);
    okCancelPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    okBtn = new JButton("Ok");
    okBtn.addActionListener(this);
    cancelBtn = new JButton("Cancel");
    cancelBtn.addActionListener(this);
    okCancelPnl.add(okBtn, BorderLayout.WEST);
    okCancelPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    okCancelPnl.add(cancelBtn, BorderLayout.EAST);
    JPanel restoreBtnPnl = new JPanel(new FlowLayout());
    restoreBtn = new JButton("Restore");
    restoreBtn.addActionListener(this);
    restoreBtnPnl.add(restoreBtn);
    buttonsPnl.add(restoreBtnPnl, BorderLayout.WEST);
    buttonsPnl.add(okCancelPnl, BorderLayout.EAST);
    mainPnl.add(buttonsPnl, BorderLayout.SOUTH);
    pack();
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JRootPane(javax.swing.JRootPane) Dimension(java.awt.Dimension)

Example 3 with JRootPane

use of javax.swing.JRootPane in project ACS by ACS-Community.

the class QueryDlg method initGUI.

/**
	 * Build the GUI
	 *
	 */
private void initGUI() {
    // The actual time/date used to fill the time fields 
    Calendar calendar = Calendar.getInstance();
    guiSwitches = new LoadSwitchesPanel(loggingClient);
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    // The panel with the option of the query
    JPanel optionsPnl = new JPanel();
    GridBagLayout prefsLayout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    optionsPnl.setLayout(prefsLayout);
    // Add all the labels
    JLabel maxLogs = new JLabel("Max num of logs to load:");
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(10, 5, 5, 5);
    optionsPnl.add(maxLogs, c);
    JLabel fromLbl = new JLabel("From:");
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(fromLbl, c);
    JLabel toLbl = new JLabel("To:");
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(toLbl, c);
    JLabel routinNameLbl = new JLabel("Routine name:");
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(routinNameLbl, c);
    JLabel procNameLbl = new JLabel("Process name:");
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(procNameLbl, c);
    JLabel srcNameLbl = new JLabel("Source object:");
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(srcNameLbl, c);
    JLabel minLogType = new JLabel("From type:");
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(minLogType, c);
    JLabel maxLogType = new JLabel("To type:");
    c.gridx = 0;
    c.gridy = 7;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 10, 5);
    optionsPnl.add(maxLogType, c);
    // Add the input widgets
    fromYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
    fromYY.setName(fromLbl.getText());
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 0);
    fromYY.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromYY, c);
    JLabel separatorF1 = new JLabel("-");
    c.gridx = 2;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 0, 5, 0);
    optionsPnl.add(separatorF1, c);
    fromMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
    fromMM.setName(fromLbl.getText());
    c.gridx = 3;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromMM.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromMM, c);
    JLabel separatorF2 = new JLabel("-");
    c.gridx = 4;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(separatorF2, c);
    fromDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
    fromDD.setName(fromLbl.getText());
    c.gridx = 5;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromDD.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromDD, c);
    JLabel tlbl = new JLabel("T");
    c.gridx = 6;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(tlbl, c);
    fromHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
    fromHr.setName(fromLbl.getText());
    c.gridx = 7;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromHr.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromHr, c);
    JLabel comaF1Lbl = new JLabel(":");
    c.gridx = 8;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaF1Lbl, c);
    fromMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
    fromMin.setName(fromLbl.getText());
    c.gridx = 9;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    fromMin.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromMin, c);
    JLabel comaF2Lbl = new JLabel(":");
    c.gridx = 10;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaF2Lbl, c);
    fromSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
    fromSec.setName(fromLbl.getText());
    c.gridx = 11;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    fromSec.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(fromSec, c);
    toYY = new JTextField(Integer.toString(calendar.get(Calendar.YEAR)), 4);
    toYY.setName(toLbl.getText());
    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 5, 5, 0);
    toYY.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toYY, c);
    JLabel separatorTo1 = new JLabel("-");
    c.gridx = 2;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.insets = new Insets(5, 0, 5, 0);
    optionsPnl.add(separatorTo1, c);
    toMM = new JTextField(Integer.toString(calendar.get(Calendar.MONTH) + 1), 2);
    toMM.setName(toLbl.getText());
    c.gridx = 3;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toMM.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toMM, c);
    JLabel separatorTo2 = new JLabel("-");
    c.gridx = 4;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(separatorTo2, c);
    toDD = new JTextField(Integer.toString(calendar.get(Calendar.DAY_OF_MONTH)), 2);
    toDD.setName(toLbl.getText());
    c.gridx = 5;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toDD.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toDD, c);
    JLabel t2lbl = new JLabel("T");
    c.gridx = 6;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(t2lbl, c);
    toHr = new JTextField(Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)), 2);
    toHr.setName(toLbl.getText());
    c.gridx = 7;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toHr.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toHr, c);
    JLabel comaTo1Lbl = new JLabel(":");
    c.gridx = 8;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaTo1Lbl, c);
    toMin = new JTextField(Integer.toString(calendar.get(Calendar.MINUTE)), 2);
    toMin.setName(toLbl.getText());
    c.gridx = 9;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    toMin.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toMin, c);
    JLabel comaTo2Lbl = new JLabel(":");
    c.gridx = 10;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    optionsPnl.add(comaTo2Lbl, c);
    toSec = new JTextField(Integer.toString(calendar.get(Calendar.SECOND)), 2);
    toSec.setName(toLbl.getText());
    c.gridx = 11;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LAST_LINE_START;
    c.gridwidth = GridBagConstraints.REMAINDER;
    toSec.getDocument().addDocumentListener(new IntegerDocumentListener());
    optionsPnl.add(toSec, c);
    rowLimit = new JTextField("10000", 20);
    rowLimit.setName(maxLogs.getText());
    rowLimit.setToolTipText("Valid range  is [0, " + (Integer.MAX_VALUE - 1) + "]");
    rowLimit.getDocument().addDocumentListener(new IntegerDocumentListener());
    c.gridx = 1;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(10, 5, 5, 5);
    optionsPnl.add(rowLimit, c);
    routineName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(routineName, c);
    procName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 4;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(procName, c);
    sourceName = new JTextField("*", 20);
    c.gridx = 1;
    c.gridy = 5;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(sourceName, c);
    minLogLevelCB = setupTypeCB(minLogLevelCB);
    minLogLevelCB.setSelectedIndex(LogTypeHelper.INFO.ordinal());
    c.gridx = 1;
    c.gridy = 6;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 5, 5);
    optionsPnl.add(minLogLevelCB, c);
    maxLogLevelCB = setupTypeCB(maxLogLevelCB);
    maxLogLevelCB.setSelectedIndex(LogTypeHelper.EMERGENCY.ordinal());
    c.gridx = 1;
    c.gridy = 7;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 5, 10, 5);
    optionsPnl.add(maxLogLevelCB, c);
    // Add the OK, CANCEL buttons
    JPanel bottomPanel = new JPanel(new BorderLayout());
    JPanel btnPnl = new JPanel();
    btnPnl.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    BoxLayout boxLayout = new BoxLayout(btnPnl, BoxLayout.LINE_AXIS);
    btnPnl.setLayout(boxLayout);
    btnPnl.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    submitBtn = new JButton("Submit");
    submitBtn.addActionListener(this);
    submitBtn.setEnabled(archive.getDBStatus() == DBState.DATABASE_OK);
    doneBtn = new JButton("Cancel");
    doneBtn.addActionListener(this);
    btnPnl.add(submitBtn, BorderLayout.WEST);
    btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    btnPnl.add(doneBtn, BorderLayout.EAST);
    btnPnl.add(Box.createRigidArea(new Dimension(10, 0)));
    // Set the border and a smaller font for the label
    statusLbl.setBorder(BorderFactory.createLoweredBevelBorder());
    Font fnt = statusLbl.getFont();
    Font newFont = fnt.deriveFont(fnt.getSize() * 2 / 3);
    statusLbl.setFont(newFont);
    bottomPanel.add(btnPnl, BorderLayout.EAST);
    bottomPanel.add(statusLbl, BorderLayout.CENTER);
    // Add the subpanels
    mainPnl.add(guiSwitches, BorderLayout.NORTH);
    mainPnl.add(optionsPnl, BorderLayout.CENTER);
    mainPnl.add(bottomPanel, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Calendar(java.util.Calendar) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) Font(java.awt.Font) LoadSwitchesPanel(alma.acs.logging.io.LoadSwitchesPanel) BorderLayout(java.awt.BorderLayout) JRootPane(javax.swing.JRootPane)

Example 4 with JRootPane

use of javax.swing.JRootPane in project ACS by ACS-Community.

the class LoadURLDlg method initGUI.

/**
	 * Setup the GUI
	 */
private void initGUI() {
    JRootPane mainPnl = this.getRootPane();
    mainPnl.setLayout(new BorderLayout());
    guiSwitches = new LoadSwitchesPanel(loggingClient);
    mainPnl.add(guiSwitches, BorderLayout.NORTH);
    JPanel urlPnl = new JPanel(new FlowLayout());
    urlPnl.add(new JLabel("URL of the file: "));
    urlPnl.add(urlTF);
    mainPnl.add(urlPnl, BorderLayout.CENTER);
    JPanel btnPnl = new JPanel(new BorderLayout());
    loadBtn.addActionListener(this);
    cancelBtn.addActionListener(this);
    btnPnl.add(loadBtn, BorderLayout.WEST);
    btnPnl.add(cancelBtn, BorderLayout.EAST);
    mainPnl.add(btnPnl, BorderLayout.SOUTH);
}
Also used : JPanel(javax.swing.JPanel) LoadSwitchesPanel(alma.acs.logging.io.LoadSwitchesPanel) FlowLayout(java.awt.FlowLayout) BorderLayout(java.awt.BorderLayout) JLabel(javax.swing.JLabel) JRootPane(javax.swing.JRootPane)

Example 5 with JRootPane

use of javax.swing.JRootPane in project jdk8u_jdk by JetBrains.

the class DimensionEncapsulation method run.

@Override
public void run() {
    runTest(new Panel());
    runTest(new Button());
    runTest(new Checkbox());
    runTest(new Canvas());
    runTest(new Choice());
    runTest(new Label());
    runTest(new Scrollbar());
    runTest(new TextArea());
    runTest(new TextField());
    runTest(new Dialog(new JFrame()));
    runTest(new Frame());
    runTest(new Window(new JFrame()));
    runTest(new FileDialog(new JFrame()));
    runTest(new List());
    runTest(new ScrollPane());
    runTest(new JFrame());
    runTest(new JDialog(new JFrame()));
    runTest(new JWindow(new JFrame()));
    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()); --> don't test defines max and min in
    // terms of preferred
    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");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) Choice(java.awt.Choice) JTextArea(javax.swing.JTextArea) TextArea(java.awt.TextArea) JTextArea(javax.swing.JTextArea) Label(java.awt.Label) JLabel(javax.swing.JLabel) JTableHeader(javax.swing.table.JTableHeader) JToggleButton(javax.swing.JToggleButton) JToggleButton(javax.swing.JToggleButton) Button(java.awt.Button) JRadioButton(javax.swing.JRadioButton) JButton(javax.swing.JButton) JFrame(javax.swing.JFrame) Checkbox(java.awt.Checkbox) JDialog(javax.swing.JDialog) FileDialog(java.awt.FileDialog) Dialog(java.awt.Dialog) JTextField(javax.swing.JTextField) TextField(java.awt.TextField) JFormattedTextField(javax.swing.JFormattedTextField) JSlider(javax.swing.JSlider) ArrayList(java.util.ArrayList) List(java.awt.List) Canvas(java.awt.Canvas) JWindow(javax.swing.JWindow) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) ScrollPane(java.awt.ScrollPane) JScrollPane(javax.swing.JScrollPane) JTable(javax.swing.JTable) JSpinner(javax.swing.JSpinner) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JDialog(javax.swing.JDialog) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JInternalFrame(javax.swing.JInternalFrame) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JTextPane(javax.swing.JTextPane) JMenuItem(javax.swing.JMenuItem) Component(java.awt.Component) Scrollbar(java.awt.Scrollbar) Window(java.awt.Window) JWindow(javax.swing.JWindow) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JToolBar(javax.swing.JToolBar) JPopupMenu(javax.swing.JPopupMenu) Panel(java.awt.Panel) JEditorPane(javax.swing.JEditorPane) JRootPane(javax.swing.JRootPane) FileDialog(java.awt.FileDialog) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Aggregations

JRootPane (javax.swing.JRootPane)90 ActionEvent (java.awt.event.ActionEvent)48 KeyStroke (javax.swing.KeyStroke)35 AbstractAction (javax.swing.AbstractAction)32 Action (javax.swing.Action)29 InputMap (javax.swing.InputMap)26 JPanel (javax.swing.JPanel)16 BorderLayout (java.awt.BorderLayout)14 JButton (javax.swing.JButton)13 ActionListener (java.awt.event.ActionListener)12 JLabel (javax.swing.JLabel)12 Container (java.awt.Container)10 FlowLayout (java.awt.FlowLayout)10 Dimension (java.awt.Dimension)9 Insets (java.awt.Insets)9 BoxLayout (javax.swing.BoxLayout)9 Component (java.awt.Component)8 Frame (java.awt.Frame)7 JScrollPane (javax.swing.JScrollPane)7 GridBagConstraints (java.awt.GridBagConstraints)6