List of usage examples for javax.swing JDialog setVisible
public void setVisible(boolean b)
From source file:com.osparking.attendant.AttListForm.java
private void displayHelpDialog(JButton PWHelpButton, String title, String helpText, boolean isPassword) { JDialog helpDialog = new PWHelpJDialog(this, false, title, helpText, isPassword); int helpHt = helpDialog.getPreferredSize().height / 2; Point buttonLoc = getLocationOnCurrentScreen(PWHelpButton); Point topLeft = new Point(buttonLoc.x + 30, buttonLoc.y - helpHt); helpDialog.setLocation(topLeft);//w ww . j a v a 2s . c om helpDialog.setVisible(true); }
From source file:jeplus.JEPlusFrameMain.java
private void jMenuItemMemoryUsageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemMemoryUsageActionPerformed JDialog dialog = new JDialog((JFrame) null, "Memory Usage"); JPanel_MemoryUsage panel = new JPanel_MemoryUsage("./"); dialog.getContentPane().add(panel);/*w ww . java2 s . co m*/ dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setSize(550, 350); dialog.addWindowListener(panel); dialog.setLocationRelativeTo(this); dialog.setVisible(true); }
From source file:com.haulmont.cuba.desktop.sys.DesktopWindowManager.java
protected void assignDialogShortcuts(final JDialog dialog, JPanel panel, final Action[] actions) { ClientConfig clientConfig = configuration.getConfig(ClientConfig.class); InputMap inputMap = panel.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); ActionMap actionMap = panel.getActionMap(); String commitShortcut = getConfigValueIfConnected(clientConfig::getCommitShortcut, "cuba.gui.commitShortcut", "CTRL-ENTER"); KeyCombination okCombination = KeyCombination.create(commitShortcut); KeyStroke okKeyStroke = DesktopComponentsHelper.convertKeyCombination(okCombination); inputMap.put(okKeyStroke, "okAction"); actionMap.put("okAction", new javax.swing.AbstractAction() { @Override/*from www. ja v a 2 s .c om*/ public void actionPerformed(ActionEvent e) { for (Action action : actions) { if (action instanceof DialogAction) { switch (((DialogAction) action).getType()) { case OK: case YES: action.actionPerform(null); dialog.setVisible(false); cleanupAfterModalDialogClosed(null); return; } } } } }); String closeShortcut = getConfigValueIfConnected(clientConfig::getCloseShortcut, "cuba.gui.closeShortcut", "ESCAPE"); KeyCombination closeCombination = KeyCombination.create(closeShortcut); KeyStroke closeKeyStroke = DesktopComponentsHelper.convertKeyCombination(closeCombination); inputMap.put(closeKeyStroke, "closeAction"); actionMap.put("closeAction", new javax.swing.AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (actions.length == 1) { actions[0].actionPerform(null); dialog.setVisible(false); cleanupAfterModalDialogClosed(null); } else { for (Action action : actions) { if (action instanceof DialogAction) { switch (((DialogAction) action).getType()) { case CANCEL: case CLOSE: case NO: action.actionPerform(null); dialog.setVisible(false); cleanupAfterModalDialogClosed(null); return; } } } } } }); }
From source file:de.whiledo.iliasdownloader2.swing.service.MainController.java
@SuppressWarnings("unchecked") protected void changeLookAndFeel() { final JDialog dialog = new JDialog(mainFrame, "Design ndern"); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); Collection<TwoObjectsX<String, String>> lookAndFeels = FunctionsX.asList( new TwoObjectsX<String, String>("Metal", UIManager.getCrossPlatformLookAndFeelClassName()), new TwoObjectsX<String, String>("Betriebssystem Standard", UIManager.getSystemLookAndFeelClassName()), new TwoObjectsX<String, String>("Nimbus", NimbusLookAndFeel.class.getName())); dialog.setLayout(new GridLayout(0, 1)); ButtonGroup b = new ButtonGroup(); for (final TwoObjectsX<String, String> lookAndFeel : lookAndFeels) { JRadioButton rb = new JRadioButton(lookAndFeel.getObjectA()); if (iliasProperties.getLookAndFeel().equals(lookAndFeel.getObjectB())) { rb.setSelected(true);/* w w w . j a v a 2 s.c o m*/ } rb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { UIManager.setLookAndFeel(lookAndFeel.getObjectB()); iliasProperties.setLookAndFeel(lookAndFeel.getObjectB()); saveProperties(iliasProperties); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { showError("Fehler beim ndern des Designs", e1); } SwingUtilities.updateComponentTreeUI(mainFrame); SwingUtilities.updateComponentTreeUI(dialog); } }); b.add(rb); dialog.add(rb); } dialog.pack(); dialog.setLocationRelativeTo(mainFrame); dialog.setVisible(true); }
From source file:jeplus.JEPlusFrameMain.java
private void jMenuItemConfigActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemConfigActionPerformed JDialog ConfigDialog = new JDialog(this, "Configuration file: ", true); if (jplProgConfPanel == null) { jplProgConfPanel = new JPanelProgConfiguration(ConfigDialog, JEPlusConfig.getDefaultInstance()); }//from ww w . j ava 2 s .c o m jplProgConfPanel.setHostWindow(ConfigDialog); ConfigDialog.getContentPane().add(jplProgConfPanel); ConfigDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); ConfigDialog.setTitle(ConfigDialog.getTitle() + jplProgConfPanel.getConfigFile()); ConfigDialog.pack(); ConfigDialog.setSize(900, 650); ConfigDialog.setLocationRelativeTo(this); ConfigDialog.setVisible(true); }
From source file:net.sf.jabref.gui.openoffice.OpenOfficePanel.java
private void showConnectDialog() { dialogOkPressed = false;/*from w ww . j a va2s .co m*/ final JDialog cDiag = new JDialog(frame, Localization.lang("Set connection parameters"), true); final JTextField ooPath = new JTextField(30); JButton browseOOPath = new JButton(Localization.lang("Browse")); ooPath.setText(preferences.getOOPath()); browseOOPath.addActionListener(BrowseAction.buildForDir(ooPath)); final JTextField ooExec = new JTextField(30); JButton browseOOExec = new JButton(Localization.lang("Browse")); ooExec.setText(preferences.getExecutablePath()); browseOOExec.addActionListener(BrowseAction.buildForFile(ooExec)); final JTextField ooJars = new JTextField(30); JButton browseOOJars = new JButton(Localization.lang("Browse")); browseOOJars.addActionListener(BrowseAction.buildForDir(ooJars)); ooJars.setText(preferences.getJarsPath()); FormBuilder builder = FormBuilder.create() .layout(new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "pref")); if (OS.WINDOWS || OS.OS_X) { builder.add(Localization.lang("Path to OpenOffice/LibreOffice directory")).xy(1, 1); builder.add(ooPath).xy(3, 1); builder.add(browseOOPath).xy(5, 1); } else { builder.add(Localization.lang("Path to OpenOffice/LibreOffice executable")).xy(1, 1); builder.add(ooExec).xy(3, 1); builder.add(browseOOExec).xy(5, 1); builder.appendColumns("4dlu, pref"); builder.add(Localization.lang("Path to OpenOffice/LibreOffice library dir")).xy(1, 3); builder.add(ooJars).xy(3, 3); builder.add(browseOOJars).xy(5, 3); } builder.padding("5dlu, 5dlu, 5dlu, 5dlu"); ButtonBarBuilder bb = new ButtonBarBuilder(); JButton ok = new JButton(Localization.lang("OK")); JButton cancel = new JButton(Localization.lang("Cancel")); ActionListener tfListener = e -> { preferences.updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); cDiag.dispose(); }; ooPath.addActionListener(tfListener); ooExec.addActionListener(tfListener); ooJars.addActionListener(tfListener); ok.addActionListener(e -> { preferences.updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); dialogOkPressed = true; cDiag.dispose(); }); cancel.addActionListener(e -> cDiag.dispose()); bb.addGlue(); bb.addRelatedGap(); bb.addButton(ok); bb.addButton(cancel); bb.addGlue(); bb.padding("5dlu, 5dlu, 5dlu, 5dlu"); cDiag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); cDiag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); cDiag.pack(); cDiag.setLocationRelativeTo(frame); cDiag.setVisible(true); }
From source file:net.sf.jabref.openoffice.OpenOfficePanel.java
private void showConnectDialog() { dialogOkPressed = false;/*from w w w . jav a 2 s . c o m*/ final JDialog cDiag = new JDialog(frame, Localization.lang("Set connection parameters"), true); final JTextField ooPath = new JTextField(30); JButton browseOOPath = new JButton(Localization.lang("Browse")); ooPath.setText(Globals.prefs.get(JabRefPreferences.OO_PATH)); browseOOPath.addActionListener(BrowseAction.buildForDir(ooPath)); final JTextField ooExec = new JTextField(30); JButton browseOOExec = new JButton(Localization.lang("Browse")); ooExec.setText(Globals.prefs.get(JabRefPreferences.OO_EXECUTABLE_PATH)); browseOOExec.addActionListener(BrowseAction.buildForFile(ooExec)); final JTextField ooJars = new JTextField(30); JButton browseOOJars = new JButton(Localization.lang("Browse")); browseOOJars.addActionListener(BrowseAction.buildForDir(ooJars)); ooJars.setText(Globals.prefs.get(JabRefPreferences.OO_JARS_PATH)); DefaultFormBuilder builder = new DefaultFormBuilder( new FormLayout("left:pref, 4dlu, fill:pref:grow, 4dlu, fill:pref", "")); if (OS.WINDOWS || OS.OS_X) { builder.append(Localization.lang("Path to OpenOffice directory")); builder.append(ooPath); builder.append(browseOOPath); builder.nextLine(); } else { builder.append(Localization.lang("Path to OpenOffice executable")); builder.append(ooExec); builder.append(browseOOExec); builder.nextLine(); builder.append(Localization.lang("Path to OpenOffice library dir")); builder.append(ooJars); builder.append(browseOOJars); builder.nextLine(); } ButtonBarBuilder bb = new ButtonBarBuilder(); JButton ok = new JButton(Localization.lang("OK")); JButton cancel = new JButton(Localization.lang("Cancel")); ActionListener tfListener = (e -> { updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); cDiag.dispose(); }); ooPath.addActionListener(tfListener); ooExec.addActionListener(tfListener); ooJars.addActionListener(tfListener); ok.addActionListener(e -> { updateConnectionParams(ooPath.getText(), ooExec.getText(), ooJars.getText()); dialogOkPressed = true; cDiag.dispose(); }); cancel.addActionListener(e -> cDiag.dispose()); bb.addGlue(); bb.addRelatedGap(); bb.addButton(ok); bb.addButton(cancel); bb.addGlue(); builder.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); bb.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); cDiag.getContentPane().add(builder.getPanel(), BorderLayout.CENTER); cDiag.getContentPane().add(bb.getPanel(), BorderLayout.SOUTH); cDiag.pack(); cDiag.setLocationRelativeTo(frame); cDiag.setVisible(true); }
From source file:ffx.ui.MainPanel.java
/** * <p>//from w ww. j ava 2 s .c o m * initialize</p> */ public void initialize() { if (init) { return; } init = true; String dir = System.getProperty("user.dir", FileSystemView.getFileSystemView().getDefaultDirectory().getAbsolutePath()); setCWD(new File(dir)); locale = new FFXLocale("en", "US"); JDialog splashScreen = null; ClassLoader loader = getClass().getClassLoader(); if (!GraphicsEnvironment.isHeadless()) { // Splash Screen JFrame.setDefaultLookAndFeelDecorated(true); splashScreen = new JDialog(frame, false); ImageIcon logo = new ImageIcon(loader.getResource("ffx/ui/icons/splash.png")); JLabel ffxLabel = new JLabel(logo); ffxLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED)); Container contentpane = splashScreen.getContentPane(); contentpane.setLayout(new BorderLayout()); contentpane.add(ffxLabel, BorderLayout.CENTER); splashScreen.setUndecorated(true); splashScreen.pack(); Dimension screenDimension = getToolkit().getScreenSize(); Dimension splashDimension = splashScreen.getSize(); splashScreen.setLocation((screenDimension.width - splashDimension.width) / 2, (screenDimension.height - splashDimension.height) / 2); splashScreen.setResizable(false); splashScreen.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); splashScreen.setVisible(true); // Make all pop-up Menus Heavyweight so they play nicely with Java3D JPopupMenu.setDefaultLightWeightPopupEnabled(false); } // Create the Root Node dataRoot = new MSRoot(); Border bb = BorderFactory.createEtchedBorder(EtchedBorder.RAISED); statusLabel = new JLabel(" "); JLabel stepLabel = new JLabel(" "); stepLabel.setHorizontalAlignment(JLabel.RIGHT); JLabel energyLabel = new JLabel(" "); energyLabel.setHorizontalAlignment(JLabel.RIGHT); JPanel statusPanel = new JPanel(new GridLayout(1, 3)); statusPanel.setBorder(bb); statusPanel.add(statusLabel); statusPanel.add(stepLabel); statusPanel.add(energyLabel); if (!GraphicsEnvironment.isHeadless()) { GraphicsConfigTemplate3D template3D = new GraphicsConfigTemplate3D(); template3D.setDoubleBuffer(GraphicsConfigTemplate.PREFERRED); GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getBestConfiguration(template3D); graphicsCanvas = new GraphicsCanvas(gc, this); graphicsPanel = new GraphicsPanel(graphicsCanvas, statusPanel); } // Initialize various Panels hierarchy = new Hierarchy(this); hierarchy.setStatus(statusLabel, stepLabel, energyLabel); keywordPanel = new KeywordPanel(this); modelingPanel = new ModelingPanel(this); JPanel treePane = new JPanel(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(hierarchy, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); treePane.add(scrollPane, BorderLayout.CENTER); tabbedPane = new JTabbedPane(); ImageIcon graphicsIcon = new ImageIcon(loader.getResource("ffx/ui/icons/monitor.png")); ImageIcon keywordIcon = new ImageIcon(loader.getResource("ffx/ui/icons/key.png")); ImageIcon modelingIcon = new ImageIcon(loader.getResource("ffx/ui/icons/cog.png")); tabbedPane.addTab(locale.getValue("Graphics"), graphicsIcon, graphicsPanel); tabbedPane.addTab(locale.getValue("KeywordEditor"), keywordIcon, keywordPanel); tabbedPane.addTab(locale.getValue("ModelingCommands"), modelingIcon, modelingPanel); tabbedPane.addChangeListener(this); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, treePane, tabbedPane); /* splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, treePane, graphicsPanel); */ splitPane.setResizeWeight(0.25); splitPane.setOneTouchExpandable(true); setLayout(new BorderLayout()); add(splitPane, BorderLayout.CENTER); if (!GraphicsEnvironment.isHeadless()) { mainMenu = new MainMenu(this); add(mainMenu.getToolBar(), BorderLayout.NORTH); getModelingShell(); loadPrefs(); SwingUtilities.updateComponentTreeUI(SwingUtilities.getRoot(this)); splashScreen.dispose(); } }
From source file:edu.umich.robot.GuiApplication.java
public void createSuperdroidRobotDialog() { final Pose pose = new Pose(); FormLayout layout = new FormLayout("right:pref, 4dlu, 30dlu, 4dlu, right:pref, 4dlu, 30dlu", "pref, 2dlu, pref, 2dlu, pref"); layout.setRowGroups(new int[][] { { 1, 3 } }); final JDialog dialog = new JDialog(frame, "Create Superdroid Robot", true); dialog.setLayout(layout);//from ww w . java2 s. com final JTextField name = new JTextField(); final JTextField x = new JTextField(Double.toString((pose.getX()))); final JTextField y = new JTextField(Double.toString((pose.getY()))); final JButton cancel = new JButton("Cancel"); final JButton ok = new JButton("OK"); CellConstraints cc = new CellConstraints(); dialog.add(new JLabel("Name"), cc.xy(1, 1)); dialog.add(name, cc.xyw(3, 1, 5)); dialog.add(new JLabel("x"), cc.xy(1, 3)); dialog.add(x, cc.xy(3, 3)); dialog.add(new JLabel("y"), cc.xy(5, 3)); dialog.add(y, cc.xy(7, 3)); dialog.add(cancel, cc.xyw(1, 5, 3)); dialog.add(ok, cc.xyw(5, 5, 3)); x.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setX(Double.parseDouble(x.getText())); } catch (NumberFormatException ex) { x.setText(Double.toString(pose.getX())); } } }); y.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { try { pose.setY(Double.parseDouble(y.getText())); } catch (NumberFormatException ex) { y.setText(Double.toString(pose.getX())); } } }); final ActionListener okListener = new ActionListener() { public void actionPerformed(ActionEvent e) { String robotName = name.getText().trim(); if (robotName.isEmpty()) { logger.error("Create Superdroid: robot name empty"); return; } for (char c : robotName.toCharArray()) if (!Character.isDigit(c) && !Character.isLetter(c)) { logger.error("Create Superdroid: illegal robot name"); return; } controller.createSuperdroidRobot(robotName, pose, true); controller.createSimSuperdroid(robotName); dialog.dispose(); } }; name.addActionListener(okListener); x.addActionListener(okListener); y.addActionListener(okListener); ok.addActionListener(okListener); ActionListener cancelAction = new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); } }; cancel.addActionListener(cancelAction); dialog.getRootPane().registerKeyboardAction(cancelAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); dialog.setLocationRelativeTo(frame); dialog.pack(); dialog.setVisible(true); }
From source file:com.nikonhacker.gui.EmulatorUI.java
private void showAboutDialog() { // for copying style JLabel label = new JLabel(); Font font = label.getFont();/*from w w w .j a va2 s .c om*/ // create some css from the label's font String style = "font-family:" + font.getFamily() + ";" + "font-weight:" + (font.isBold() ? "bold" : "normal") + ";" + "font-size:" + font.getSize() + "pt;"; // html content JEditorPane editorPane = new JEditorPane("text/html", "<html><body style=\"" + style + "\">" + "<font size=\"+1\">" + ApplicationInfo.getNameVersion() + "</font><br/>" + "<i>A dual (Fujitsu FR + Toshiba TX) microcontroller emulator in Java, aimed at mimicking the behaviour of Nikon DSLRs</i><br/>" + "<font size=\"-2\">Built on " + ApplicationInfo.getBuildTime() + "</font><br/><br/>" + "This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.<br/>" + "This software is provided under the GNU General Public License, version 3 - " + makeLink("http://www.gnu.org/licenses/gpl-3.0.txt") + "<br/>" + "This software is based on, or makes use of, the following works:<ul>\n" + "<li>Simeon Pilgrim's deciphering of firmware encoding and lots of information shared on his blog - " + makeLink("http://simeonpilgrim.com/blog/") + "</li>" + "<li>Dfr Fujitsu FR diassembler Copyright (c) Kevin Schoedel - " + makeLink("http://scratchpad.wikia.com/wiki/Disassemblers/DFR") + "<br/>and its port to C# by Simeon Pilgrim</li>" + "<li>\"How To Write a Computer Emulator\" article by Marat Fayzullin - " + makeLink("http://fms.komkon.org/EMUL8/HOWTO.html") + "</li>" + "<li>The PearColator x86 emulator project - " + makeLink("http://apt.cs.man.ac.uk/projects/jamaica/tools/PearColator/") + "</li>" + "<li>The Jacksum checksum library Copyright (c) Dipl.-Inf. (FH) Johann Nepomuk Lfflmann - " + makeLink("http://www.jonelo.de/java/jacksum/") + "</li>" + "<li>HexEditor & RSyntaxTextArea swing components, Copyright (c) Robert Futrell - " + makeLink("http://fifesoft.com/hexeditor/") + "</li>" + "<li>JGraphX graph drawing library, Copyright (c) JGraph Ltd - " + makeLink("http://www.jgraph.com/jgraph.html") + "</li>" + "<li>Apache commons libraries, Copyright (c) The Apache Software Foundation - " + makeLink("http://commons.apache.org/") + "</li>" + "<li>VerticalLayout, Copyright (c) Cellspark - " + makeLink("http://www.cellspark.com/vl.html") + "</li>" + "<li>MigLayout, Copyright (c) MigInfoCom - " + makeLink("http://www.miginfocom.com/") + "</li>" + "<li>Glazed Lists, Copyright (c) 2003-2006, publicobject.com, O'Dell Engineering Ltd - " + makeLink("http://www.glazedlists.com/") + "</li>" + "<li>Samples from the Java Tutorial (c) Sun Microsystems / Oracle - " + makeLink("http://docs.oracle.com/javase/tutorial") + "</li>" + "<li>MARS, MIPS Assembler and Runtime Simulator (c) 2003-2011, Pete Sanderson and Kenneth Vollmar - " + makeLink("http://courses.missouristate.edu/KenVollmar/MARS") + "</li>" + "<li>SteelSeries (and SteelCheckBox) Swing components (c) 2010, Gerrit Grunwald - " + makeLink("http://harmoniccode.blogspot.be/search/label/steelseries") + "</li>" + "</ul>" + "License terms for all included code are available in the 'licenses' folder of the distribution." + "<p>For more information, help or ideas, please join us at " + makeLink("http://nikonhacker.com") + "</p></body></html>"); // handle link events editorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED)) { try { Desktop.getDesktop().browse(e.getURL().toURI()); } catch (Exception e1) { // noop } } } }); editorPane.setEditable(false); Color greyLayer = new Color(label.getBackground().getRed(), label.getBackground().getGreen(), label.getBackground().getBlue(), 192); editorPane.setBackground(greyLayer); //editorPane.setOpaque(false); // show // JOptionPane.showMessageDialog(this, editorPane, "About", JOptionPane.PLAIN_MESSAGE); final JDialog dialog = new JDialog(this, "About", true); JPanel contentPane = new BackgroundImagePanel(new BorderLayout(), Toolkit.getDefaultToolkit().getImage(EmulatorUI.class.getResource("images/nh_full.jpg"))); contentPane.add(editorPane, BorderLayout.CENTER); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { dialog.dispose(); } }); JPanel bottomPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); bottomPanel.add(okButton); bottomPanel.setBackground(greyLayer); // bottomPanel.setOpaque(false); contentPane.add(bottomPanel, BorderLayout.SOUTH); dialog.setContentPane(contentPane); dialog.pack(); dialog.setLocationRelativeTo(this); dialog.setResizable(false); dialog.setVisible(true); }