private void initAboutBox() { aboutBox = new JDialog(this, "About Tregex"); aboutBox.getContentPane().setLayout(new BorderLayout()); aboutBox.getContentPane().add(new JLabel("<html><b>Tregex and Tsurgeon</b></html>", SwingConstants.CENTER), BorderLayout.NORTH); aboutBox.getContentPane().add(new JLabel("<html>Tregex by Galen Andrew and Roger Levy<br>Tsurgeon by Roger Levy<br>Graphical interface by Anna Rafferty<br>Additional features and development by Chris Manning<br></html>", SwingConstants.CENTER), BorderLayout.CENTER); aboutBox.getContentPane().add(new JLabel("<html><font size=2>\u00A92007 The Board of Trustees of The Leland Stanford Junior University.<br>Distributed under the GNU General Public License</font></html>", SwingConstants.CENTER), BorderLayout.SOUTH); }
final JDialog frame = new JDialog(parentFrame, frameTitle, true); frame.getContentPane().add(panel); frame.pack(); frame.setVisible(true);
public LogFactor5LoadingDialog(JFrame jframe, String message) { super(jframe, "LogFactor5", false); JPanel bottom = new JPanel(); bottom.setLayout(new FlowLayout()); JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); wrapStringOnPanel(message, main); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); show(); } //--------------------------------------------------------------------------
private void initComponents(final JDialog dialog) { dialog.setLayout(new BorderLayout()); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.getContentPane().add(editorPanel, BorderLayout.CENTER); dialog.setPreferredSize(DEF_SIZE); dialog.setMinimumSize(MIN_SIZE); dialog.pack(); } });
editorComponent = new JButton(); editorComponent.setBackground(Color.white); editorComponent.setBorderPainted(false); textArea.getInputMap().put(keyStroke, "none"); JScrollPane scrollPane = new JScrollPane( textArea ); getContentPane().add( scrollPane ); JButton cancel = new JButton("Cancel"); cancel.addActionListener( this ); JButton ok = new JButton("Ok"); ok.setPreferredSize( cancel.getPreferredSize() ); ok.addActionListener( this ); buttons.add( ok ); buttons.add( cancel ); getContentPane().add(buttons, BorderLayout.SOUTH); pack();
protected void endDialog() { Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS)); contentPane.add(messagePane); contentPane.add(buttonPane); dialog.pack(); Emulator.getMainGUI().startWindowDialog(dialog); }
private void createDialog(Frame parentFrame) { dialog = new JDialog(parentFrame); GridBag gridBag = new GridBag(dialog.getContentPane()); gridBag.add(jList, 0, 0, 3, 1, 1, 1, GridBagConstraints.BOTH, GridBagConstraints.CENTER, new Insets(10, 10, 10, 10)); gridBag.add(new JButton(new OkAction()), 1, 1, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(5, 5, 5, 5)); gridBag.add(new JButton(new CancelAction()), 2, 1, 1, 1, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER, new Insets(5, 5, 5, 5)); }
public VUMeterMonitor() { vumeter = new VUMeter(); vuMeterPanel = new VUMeterPanel(); vuMeterPanel.setVu(vumeter); vuMeterPanel.start(); vuMeterDialog = new JDialog(); vuMeterDialog.setBounds(100, 100, 100, 400); vuMeterDialog.getContentPane().setLayout(new BorderLayout()); vuMeterDialog.getContentPane().add(vuMeterPanel); vuMeterDialog.setVisible(true); }
public LogFactor5LoadingDialog(JFrame jframe, String message) { super(jframe, "LogFactor5", false); JPanel bottom = new JPanel(); bottom.setLayout(new FlowLayout()); JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); wrapStringOnPanel(message, main); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); show(); } //--------------------------------------------------------------------------
private void installPlugin(final File plugin) { final JDialog dialog = new JDialog(frame, "Installing Plugin", true); dialog.getContentPane().setLayout(new BorderLayout()); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); bar.setString("Installing Plugin. Please wait..."); bar.setStringPainted(true); dialog.getContentPane().add(bar, BorderLayout.CENTER); dialog.pack(); dialog.setSize(225, 55); dialog.setVisible(true);
protected JDialog createDialog(Component parent) { Frame frame = parent instanceof Frame ? (Frame) parent : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); JDialog dialog = new JDialog(frame, ("Select Font"), true); Action okAction = new DialogOKAction(dialog); Action cancelAction = new DialogCancelAction(dialog); JButton okButton = new JButton(okAction); okButton.setFont(DEFAULT_FONT); JButton cancelButton = new JButton(cancelAction); cancelButton.setFont(DEFAULT_FONT); JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(2, 1)); buttonsPanel.add(okButton); buttonsPanel.add(cancelButton); buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10)); ActionMap actionMap = buttonsPanel.getActionMap(); actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction); actionMap.put(okAction.getValue(Action.DEFAULT), okAction); InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT)); inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT)); JPanel dialogEastPanel = new JPanel(); dialogEastPanel.setLayout(new BorderLayout()); dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH); dialog.getContentPane().add(this, BorderLayout.CENTER); dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST); dialog.pack(); dialog.setLocationRelativeTo(frame); return dialog; }
dialog = new javax.swing.JDialog(parentDlg, title, true); } else { dialog = new javax.swing.JDialog(frame, title, true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(chooser, BorderLayout.CENTER); dialog.pack(); dialog.setBounds(findCenterBounds(parent.getGraphicsConfiguration(), dialog.getSize()));
frame.getContentPane().add(new MyFramePanel()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); private JButton openDialogeBtn = new JButton("Open Dialog"); field.setFocusable(false); add(field); add(openDialogeBtn); Window win = SwingUtilities.getWindowAncestor(this); if (win != null) { dialog = new JDialog(win, "My Dialog", ModalityType.APPLICATION_MODAL); dialog.getContentPane().add(dialogPanel); dialog.pack(); dialog.setLocationRelativeTo(null); private JButton okButton = new JButton("OK");
public int show(JFrame frame) { dialog = new JDialog(frame, "Save Changes", true); Container contentPane = dialog.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(this, BorderLayout.CENTER); dialog.setResizable(false); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.getRootPane().setDefaultButton(saveButton); dialog.setVisible(true); dialog.dispose(); return selectedValue; }
public LogFactor5ErrorDialog(JFrame jframe, String message) { super(jframe, "Error", true); JButton ok = new JButton("Ok"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { hide(); } }); JPanel bottom = new JPanel(); bottom.setLayout(new FlowLayout()); bottom.add(ok); JPanel main = new JPanel(); main.setLayout(new GridBagLayout()); wrapStringOnPanel(message, main); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); show(); } //--------------------------------------------------------------------------
private JDialog createJumpDialog() final JDialog dialog = new JDialog(SwingUtilities.windowForComponent(this), "Jump to index"); dialog.setLocationRelativeTo(this); final JLabel nowLabel = new JLabel("Present index: " + selectedIndex); contentPanel.add(panel); contentPanel.add(inputPanel); dialog.getContentPane().add(contentPanel); dialog.pack(); return dialog;
bottom.setLayout(new FlowLayout()); main.setLayout(new FlowLayout()); main.add(new JLabel(label)); _textField = new JTextField(size); main.add(_textField); JButton ok = new JButton("Ok"); ok.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JButton cancel = new JButton("Cancel"); cancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { bottom.add(ok); bottom.add(cancel); getContentPane().add(main, BorderLayout.CENTER); getContentPane().add(bottom, BorderLayout.SOUTH); pack(); centerWindow(this);
public static void main(String... args) { JFrame f = new JFrame(); f.setSize(600, 400); f.setVisible(true); MageFloatPane fp = new MageFloatPane(); fp.setCard("Card"); MageRoundPane popupContainer = new MageRoundPane(); popupContainer.setLayout(null); popupContainer.add(fp); //popupContainer.setVisible(false); popupContainer.setBounds(0, 0, 320 + 80, 201 + 80); JDialog floatOnParent = new JDialog(f, false); floatOnParent.setUndecorated(true); floatOnParent.getContentPane().add(popupContainer); floatOnParent.setBounds(300, 100, 300, 200); floatOnParent.setVisible(true); } }
frame.addInternalFrameListener(InternalWindowListener.wrap(listener)); ((JDesktopPane) owner).add(frame); frame.getContentPane().add(panel); frame.pack(); return frame; final JDialog dialog = new JDialog((Frame) owner, title); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.addWindowListener(listener); dialog.getContentPane().add(panel); dialog.pack(); return dialog; final JDialog dialog = new JDialog((Dialog) owner, title); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.addWindowListener(listener); dialog.getContentPane().add(panel); dialog.pack(); return dialog;
public void run() { JFrame frame = new JFrame(); JButton button = new JButton(); button.addActionListener(new ActionListener() { @Override frame.getContentPane().add(button); frame.pack(); frame.setVisible(true); private JDialog dialog = new JDialog(frame, "Swingworker test", true); private JProgressBar progressBar = new JProgressBar(); progressBar.setStringPainted(true); progressBar.setIndeterminate(true); dialog.getContentPane().add(progressBar); dialog.pack(); dialog.setModal( false ); System.out.println("done"); JLabel label = new JLabel("Task Complete"); dialog.getContentPane().remove(progressBar); dialog.getContentPane().add(label); dialog.getContentPane().validate();