UserInputValidationErrorBox(Frame parent, YWorkItem item, YDataStateException e) { super(parent, "Problem with your input data"); Container c = getContentPane(); c.setLayout(new BorderLayout()); JPanel p = new JPanel(new BorderLayout()); p.setBackground(YAdminGUI._apiColour); p.add(createTopPanel(item), BorderLayout.NORTH); p.add(createCentrePanel(e), BorderLayout.CENTER); c.add(p, BorderLayout.CENTER); c.add(createBottomPanel(), BorderLayout.SOUTH); c.setBackground(YAdminGUI._apiColour); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { storeData(); this_windowClosing(); } }); Double screenWidth = new Double( GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth()); Double screenHeight = new Double( GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight()); setSize(new Double(screenWidth * 0.8).intValue(), new Double(screenHeight * 0.8).intValue()); Dimension labelSize = this.getSize(); setLocation( screenWidth.intValue() / 2 - (labelSize.width / 2), screenHeight.intValue() / 2 - (labelSize.height / 2)); show(); }
/** * Cr�e une nouvelle instance de CreeTrans * * @param mf fenetre principale de l'application * @param zg Zone graphique * @param auto automate * @param be barre d'�tat */ public TransCreator(MainFrame mf, GraphicZone g, Automate auto, StateBar be) { super(JOptionPane.getFrameForComponent(mf), "Creating interaction", true); this.setResizable(false); this.gz = g; this.auto = auto; this.bar = be; this.mf = mf; be.displayInfo("Creating interaction"); tfJPanel1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel1.setBackground(Color.lightGray); tfJPanel1.add(new JLabel("Type : ")); groupe = new CheckboxGroup(); plus = new Checkbox("activator", groupe, true); tfJPanel1.add(plus); minus = new Checkbox("inhibitor", groupe, false); tfJPanel1.add(minus); tfJPanel2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); tfJPanel2.setBackground(Color.lightGray); tfJPanel2.add(new JLabel("Threshold = ")); tf = new JTextField(auto.nbrCharTransLabel); tf.setText("1"); tfJPanel2.add(tf); btJPanel = new JPanel(new GridLayout(1, 2, 0, 0)); btJPanel.setBackground(Color.lightGray); ok = new Button("Ok"); ok.setBackground(Color.lightGray); ok.addActionListener(this); cancel = new Button("Cancel"); cancel.setBackground(Color.lightGray); cancel.addActionListener(this); btJPanel.add(ok); btJPanel.add(cancel); content = this.getContentPane(); content.setLayout(new BorderLayout()); content.setBackground(Color.lightGray); content.add(tfJPanel1, BorderLayout.NORTH); content.add(tfJPanel2, BorderLayout.CENTER); content.add(btJPanel, BorderLayout.SOUTH); this.pack(); this.setLocationRelativeTo(this.mf); tf.requestFocusInWindow(); // rendre la fenetre visible setVisible(true); }
public void add() { mainFrame.setDefaultCloseOperation(mainFrame.EXIT_ON_CLOSE); statusPanel.add(jl); menuBar.add(menu); menu.add(menuItem); menuItem.addActionListener(this); container.setLayout(new BorderLayout()); container.add(menuBar, BorderLayout.NORTH); container.add(jl, BorderLayout.SOUTH); mainFrame.pack(); mainFrame.setVisible(true); }
private void initPanels() { Container contentPane = getContentPane(); humanArea = new PlayerView("Me"); computerArea = new PlayerView("Computer"); myBoardPanel4 = new BoggleBoardPanel(4, 4); myBoardPanel5 = new BoggleBoardPanel(5, 5); myBoardPanel = myBoardPanel5; wordEntryField = new WordEntryField(); contentPane.add(wordEntryField, BorderLayout.SOUTH); contentPane.add(humanArea, BorderLayout.WEST); contentPane.add(myBoardPanel, BorderLayout.CENTER); contentPane.add(computerArea, BorderLayout.EAST); contentPane.add(makeProgressBar(), BorderLayout.NORTH); }
public void play(int lv) { jl.setText("Level " + level); Game game = new Game(lv); // An object representing the game View view = new View(game); // An object representing the view of the game game.newGame(); view.print(); gameBoardPanel = view.mainPanel; ButtonPanel buttonPanel = new ButtonPanel(game); container.add(buttonPanel, BorderLayout.EAST); container.add(gameBoardPanel, BorderLayout.WEST); mainFrame.pack(); // Main game loop while (true) { view.print(); gameBoardPanel = view.mainPanel; // Win/lose conditions if (game.isWin()) { view.print(); gameBoardPanel = view.mainPanel; int choice; choice = JOptionPane.showConfirmDialog(null, "You win!", "", JOptionPane.OK_OPTION); if (choice == JOptionPane.OK_OPTION) { level++; mainFrame.remove(buttonPanel); mainFrame.remove(gameBoardPanel); play(level); } } if (game.isLose()) { view.print(); gameBoardPanel = view.mainPanel; int choice; choice = JOptionPane.showConfirmDialog( null, "You lose!", "Would you like to play again?", JOptionPane.YES_NO_OPTION); if (choice == JOptionPane.YES_OPTION) { level = 1; mainFrame.remove(buttonPanel); mainFrame.remove(gameBoardPanel); play(level); } else { System.exit(0); } } } }
public MsnTreeTest() { String[] tab = {"hello", "test", "blabla"}; container = getContentPane(); container.setLayout(null); eleve = new DefaultMutableTreeNode("MSN"); worker = new DefaultMutableTreeNode("Worker"); prof = new DefaultMutableTreeNode("Profs"); for (int i = 0; i < tab.length; i++) { worker.add(new DefaultMutableTreeNode(tab[i])); prof.add(new DefaultMutableTreeNode(tab[i])); } // worker.add(new DefaultMutableTreeNode("hello world2")); eleve.add(worker); eleve.add(prof); tree = new JTree(eleve); scroll = new JScrollPane(tree); scroll.setBounds(10, 10, 100, 100); container.add(scroll); setSize(300, 300); setLocation(200, 200); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); // worker.add(n); }
public void actionPerformed(ActionEvent e) { if (elementTreeFrame == null) { // Create a frame containing an instance of // ElementTreePanel. try { String title = resources.getString("ElementTreeFrameTitle"); elementTreeFrame = new JFrame(title); } catch (MissingResourceException mre) { elementTreeFrame = new JFrame(); } elementTreeFrame.addWindowListener( new WindowAdapter() { @Override public void windowClosing(WindowEvent weeee) { elementTreeFrame.setVisible(false); } }); Container fContentPane = elementTreeFrame.getContentPane(); fContentPane.setLayout(new BorderLayout()); elementTreePanel = new ElementTreePanel(getEditor()); fContentPane.add(elementTreePanel); elementTreeFrame.pack(); } elementTreeFrame.setVisible(true); }
public void setUpGUI(Container container) { // <Begin_setUpGUI_Container> container.add(Top, BorderLayout.CENTER); Top.setLayout(new BorderLayout(5, 5)); Top.add(JPanel1, BorderLayout.CENTER); JPanel1.setLayout(new BorderLayout(5, 5)); JPanel1.add(JScrollPane1, BorderLayout.CENTER); JScrollPane1.getViewport().add(JTable1); JPanel1.add(JPanel6, BorderLayout.WEST); JPanel6.setLayout(new BorderLayout(5, 5)); JPanel6.add(JLabel2, BorderLayout.CENTER); Top.add(JPanel2, BorderLayout.SOUTH); JPanel2.setLayout(new GridLayout(1, 1, 5, 5)); JPanel2.add(JPanel3); JPanel3.setLayout(new FlowLayout(2, 5, 5)); JPanel3.add(JButton1); JPanel3.add(JButton2); JPanel3.add(JButton3); JPanel3.add(closeButton); Top.add(JPanel5, BorderLayout.NORTH); JPanel5.setLayout(new GridLayout(2, 1, 5, 5)); JPanel5.add(JLabel1); // <End_setUpGUI_Container> }
public static void addToGridBag( GridBagLayout grid, Container cont, Component comp, int x, int y, int gw, int gh, double wx, double wy, int fill, int anchor) { // now the constraints GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = x; gbc.gridy = y; gbc.weightx = wx; gbc.weighty = wy; gbc.fill = fill; gbc.gridwidth = gw; gbc.gridheight = gh; gbc.anchor = anchor; cont.add(comp); grid.setConstraints(comp, gbc); }
public objUpdate() { super("Person"); setBounds(150, 150, 200, 120); setResizable(false); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); Container con = this.getContentPane(); con.setLayout(new FlowLayout()); con.add(n); con.add(d); next.setMnemonic('N'); newPerson.setMnemonic('P'); con.add(next); con.add(newPerson); this.addWindowListener(new Window()); next.addActionListener(new Next()); newPerson.addActionListener(new NewPerson()); setVisible(true); }
public static void main(String[] argv) throws NoSuchMethodException { f = new JFrame(); Container c = f.getContentPane(); c.setLayout(new BorderLayout()); c.add(new WordListScreen(null), BorderLayout.CENTER); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); showFrame(true); }
public RegistracijosForma() { Container vidus = getContentPane(); vidus.setLayout(new BoxLayout(vidus, BoxLayout.Y_AXIS)); vidus.add(panAutoSąr); vidus.add(panDuomenys); jbReg.addActionListener(this); jbRasti.addActionListener(this); jbSkaityti.addActionListener(this); jbSaveObj.addActionListener(this); jbLoadObj.addActionListener(this); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); // setSize(400,600); išdėstymas(); kosmetika(); setVisible(true); // deserializuojame rg objektą su visomis struktūromis rg = (RegistracijaAuto) loadObject("temp.obj"); if (rg == null) rg = new RegistracijaAuto(); rodytiAutoRinkinius(); pack(); }
public VertexInfoDialog(Vertex vertex) { v = vertex; setTitle("Vertex: " + v.getName()); Container cp = getContentPane(); JPanel p = new JPanel(); p.setLayout(new GridLayout(1, 1)); opis = new TextArea(v.getInfo()); opis.setEditable(false); p.add(opis, new FlowLayout()); cp.add(p); setSize(200, 300); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
// Set up the quiz window Quiz() { initializeData(); setTitle("FOSS Quiz App"); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(440, 400); setLocation(300, 100); setResizable(true); Container cont = getContentPane(); cont.setLayout(null); cont.setBackground(Color.WHITE); bg = new ButtonGroup(); choice1 = new JRadioButton("Choice1", true); choice2 = new JRadioButton("Choice2", false); choice3 = new JRadioButton("Choice3", false); choice4 = new JRadioButton("Choice4", false); bg.add(choice1); bg.add(choice2); bg.add(choice3); bg.add(choice4); lblmess = new JLabel("Choose a correct anwswer"); lblmess.setForeground(Color.BLACK); lblmess.setFont(new Font("Sans_Serif", Font.BOLD, 15)); btnext = new JButton("Next"); btnext.setForeground(Color.WHITE); btnext.setFont(new Font("Sans_Serif", Font.BOLD, 17)); btnext.setBackground(Color.DARK_GRAY); btnext.addActionListener(this); panel = new JPanel(); panel.setBackground(Color.WHITE); panel.setLocation(10, 60); panel.setSize(400, 300); panel.setLayout(new GridLayout(0, 1)); title = new JPanel(); title.setBackground(Color.WHITE); title.setLocation(10, 10); title.setSize(1000, 50); title.setLayout(new GridLayout(1, 0)); title.add(lblmess); panel.add(choice1); panel.add(choice2); panel.add(choice3); panel.add(choice4); panel.add(btnext); cont.add(title); cont.add(panel); setVisible(true); quizAnswerID = 0; readQuestionAnswer(quizAnswerID); }
SpecificationQueryProcessingValidationErrorBox( Frame parent, YWorkItem item, YDataStateException message) { super(parent, "Runtime Problem with Process Specification detected"); Container c = getContentPane(); c.setLayout(new BorderLayout()); JPanel p = new JPanel(new BorderLayout()); p.setBackground(YAdminGUI._apiColour); p.add(createCentrePanel(message), BorderLayout.CENTER); c.add(p, BorderLayout.CENTER); c.add(createBottomPanel(), BorderLayout.SOUTH); c.setBackground(YAdminGUI._apiColour); addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { storeData(); this_windowClosing(); } }); // setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setSize(800, 600); Double screenWidth = new Double( GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getWidth()); Double screenHeight = new Double( GraphicsEnvironment.getLocalGraphicsEnvironment().getMaximumWindowBounds().getHeight()); // setSize(new Double((screenWidth - guiSize.width) * 2).intValue(), new // Double((screenHeight - guiSize.height) * 2).intValue()); // setLocation(((screenWidth.intValue() - guiSize.width) / 2),0); // pack(); Dimension labelSize = this.getSize(); setLocation( screenWidth.intValue() / 2 - (labelSize.width / 2), screenHeight.intValue() / 2 - (labelSize.height / 2)); show(); }
public void setUpGUI(Container container) throws Exception { // <Begin_setUpGUI_Container> container.add(Top, BorderLayout.CENTER); Top.setLayout(null); JPanel1.setBounds(0, 0, 225, 415); Top.add(JPanel1); JPanel1.setLayout(null); RouterBtn.setBounds(60, 95, 110, 165); JPanel1.add(RouterBtn); eight.setBounds(170, 155, 45, 45); JPanel1.add(eight); one.setBounds(170, 105, 45, 45); JPanel1.add(one); six.setBounds(65, 40, 45, 55); JPanel1.add(six); three.setBounds(15, 105, 45, 45); JPanel1.add(three); four.setBounds(15, 205, 45, 45); JPanel1.add(four); seven.setBounds(15, 155, 45, 45); JPanel1.add(seven); two.setBounds(170, 205, 45, 45); JPanel1.add(two); ten.setBounds(120, 260, 45, 55); JPanel1.add(ten); five.setBounds(65, 260, 45, 55); JPanel1.add(five); nine.setBounds(120, 40, 45, 55); JPanel1.add(nine); JPanel2.setBounds(220, 0, 455, 415); Top.add(JPanel2); JPanel2.setLayout(new BorderLayout(5, 5)); JPanel2.add(JPanel3, BorderLayout.NORTH); JPanel3.setLayout(new FlowLayout(1, 5, 5)); JPanel3.add(JLabel1); JPanel2.add(JPanel4, BorderLayout.CENTER); JPanel4.setLayout(new CardLayout(5, 5)); JPanel2.add(JPanel5, BorderLayout.SOUTH); JPanel5.setLayout(new FlowLayout(2, 5, 5)); JPanel5.add(RefreshBtn); JPanel5.add(CloseBtn); // <End_setUpGUI_Container> }
public BearSweeper() { super("BearSweeper"); Container contentPane = getContentPane(); panel = new DrawingPanel(); contentPane.add(panel, BorderLayout.CENTER); timerOn = true; time = 0; timer = new Timer(100, new TimerEventHandler()); Square.loadGraphics(); addMenus(); newGame(); timer.start(); // Loads and plays background music in a loop backgroundMusic = Applet.newAudioClip(getCompleteURL("background.wav")); backgroundMusic.loop(); } // Constructor
public MapViewer(String title) { super(title); setSize(800, 600); // setExtendedState(Frame.MAXIMIZED_BOTH); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); edgeCnt = 0; startMap(); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); cp.setBackground(Color.lightGray); // vv.getModel().getRelaxer().setSleepTime(500); vv.setGraphMouse(new DefaultModalGraphMouse<Number, Number>()); vv.getRenderer() .getVertexLabelRenderer() .setPosition(edu.uci.ics.jung.visualization.renderers.Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>()); vv.setForeground(Color.white); cp.add(vv, BorderLayout.CENTER); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); setVisible(true); JMenuBar jb = new JMenuBar(); JMenu fileMenu = new JMenu("File"); jb.add(fileMenu); JMenuItem exitMenu = new JMenuItem("Exit"); fileMenu.add(exitMenu); exitMenu.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { MapViewer.this.dispose(); } }); JMenu helpMenu = new JMenu("Help"); jb.add(helpMenu); JMenuItem aboutItem = new JMenuItem("About"); helpMenu.add(aboutItem); aboutItem.addActionListener(new AboutActionListener()); this.setJMenuBar(jb); setLocationRelativeTo(null); }
/** * @param filenames * @exception Exception if internal error */ public ChestImageViewer(String filenames[]) throws Exception { DisplayDeviceArea[] displayDeviceAreas = getPresentationAndImageDeviceAreas(); if (displayDeviceAreas == null) { System.err.println("Cannot determine device display areas"); } else { System.err.println("Found " + displayDeviceAreas.length + " device display areas"); for (int i = 0; i < displayDeviceAreas.length; ++i) { System.err.println("[" + i + "] = " + displayDeviceAreas[i]); displayDeviceAreas[i].getFrame().setBackground(Color.black); displayDeviceAreas[i].getFrame().setVisible(true); } { // Need to actually add something to the unused left display frame, else background will not // be set to black on Windows JPanel backgroundPanel = new JPanel(); backgroundPanel.setBackground(Color.black); displayDeviceAreas[0].getFrame().getContentPane().add(backgroundPanel); displayDeviceAreas[0].getFrame().validate(); } frame = displayDeviceAreas[1].getFrame(); Container content = frame.getContentPane(); content.setLayout(new GridLayout(1, 1)); multiPanel = new JPanel(); // multiPanel.setBackground(Color.black); frameWidth = (int) frame.getWidth(); frameHeight = (int) frame.getHeight(); Dimension d = new Dimension(frameWidth, frameHeight); // multiPanel.setSize(d); multiPanel.setPreferredSize(d); multiPanel.setBackground(Color.black); content.add(multiPanel); // frame.pack(); content.validate(); loadMultiPanelFromSpecifiedFiles(filenames); } }
public InstantMessageFrame( String clientUsername, java.util.List<String> friendsListArray, HashMap<String, InstantMessageDialog> currentConversations, ClientMessageGetterSender clientMessageGetterSender) { super(clientUsername); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.clientUsername = clientUsername; this.friendsList = new JList(friendsListArray.toArray()); this.currentConversations = currentConversations; this.clientMessageGetterSender = clientMessageGetterSender; // Setup the InstantMessageFrame Container instantMessageFrameContentPane = this.getContentPane(); instantMessageFrameContentPane.setLayout(new BorderLayout()); instantMessageFrameContentPane.add(getFriendsPane(), BorderLayout.CENTER); // Create handler for double-clicks on the friends list DisplayMessageDialogHandler displayMessageDialogHandler = new DisplayMessageDialogHandler( clientUsername, currentConversations, clientMessageGetterSender); friendsList.addMouseListener(displayMessageDialogHandler); }
// Construct GUI for a set of parameters public static void makeControls( Container controls, GridBagLayout controlLayout, GridBagConstraints controlCon, Vector dpList, Vector optList, String title) { Container spec = new Container(); controlLayout.setConstraints(spec, controlCon); controls.add(spec); GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); spec.setLayout(layout); Iterator i = dpList.iterator(); while (i.hasNext()) { DoubleParameter dp = (DoubleParameter) (i.next()); // Make slider and text field JSlider val = new JSlider(JSlider.HORIZONTAL); JTextField tval = new JTextField(5); dp.register(val); dp.register(tval); // Lay out label, slider, text field con.fill = GridBagConstraints.NONE; con.weightx = 0.0; con.weighty = 0.0; con.gridwidth = 1; JLabel name = new JLabel(dp.name); layout.setConstraints(name, con); spec.add(name); con.fill = GridBagConstraints.HORIZONTAL; con.weightx = 0.8; layout.setConstraints(val, con); spec.add(val); con.weightx = 0.2; con.gridwidth = GridBagConstraints.REMAINDER; layout.setConstraints(tval, con); spec.add(tval); } // Label column on bottom con.fill = GridBagConstraints.VERTICAL; con.anchor = GridBagConstraints.SOUTH; con.weightx = 0.0; con.weighty = 1.0; con.gridwidth = GridBagConstraints.REMAINDER; JLabel ltitle = new JLabel(title); layout.setConstraints(ltitle, con); spec.add(ltitle); // Display options con.anchor = GridBagConstraints.WEST; i = optList.iterator(); while (i.hasNext()) { BooleanParameter bp = (BooleanParameter) (i.next()); JCheckBox ck = new JCheckBox(bp.name); bp.register(ck); layout.setConstraints(ck, con); spec.add(ck); } }
// Main program -- create and start GUI public Mesh(boolean debug) { // Create drawing area for shape worldDraw = new WorldView(this, shape, debug); worldDraw.setSize(500, 500); // Create menubar JMenuBar menubar = new JMenuBar(); setJMenuBar(menubar); JMenu menu = new JMenu("File"); menu.getPopupMenu().setLightWeightPopupEnabled(false); menubar.add(menu); // Exit when quit selected JMenuItem resetm = menu.add("Reset"); resetm.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { Parameter.blockAction(true); // Reset all parameters shape.reset(); Parameter.blockAction(false); Parameter.onUserAction(); } }); // Exit when quit selected JMenuItem quitm = menu.add("Quit"); quitm.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); // ------------------------------------------------------ // Lay out main window GridBagLayout layout = new GridBagLayout(); GridBagConstraints con = new GridBagConstraints(); Container c = getContentPane(); c.setLayout(layout); // World viewport con.gridwidth = 1; con.weightx = 0.2; con.weighty = 1.0; con.fill = GridBagConstraints.BOTH; con.insets = new Insets(4, 4, 4, 2); layout.setConstraints(worldDraw, con); c.add(worldDraw); // -- Parameter controls // Make container for controls Container cc = new Container(); con.gridwidth = GridBagConstraints.REMAINDER; con.weightx = 0.2; con.weighty = 1.0; con.fill = GridBagConstraints.HORIZONTAL; layout.setConstraints(cc, con); c.add(cc); // Fill compartment GridBagLayout clayout = new GridBagLayout(); cc.setLayout(clayout); GridBagConstraints ccon = new GridBagConstraints(); ccon.weightx = 1.0; ccon.weighty = 1.0; ccon.anchor = GridBagConstraints.NORTH; ccon.insets = new Insets(10, 10, 0, 10); ccon.fill = GridBagConstraints.BOTH; ccon.gridwidth = GridBagConstraints.REMAINDER; makeControls(cc, clayout, ccon, shape.getParams(), shape.getOptions(), "Object parameters"); // ------------------------------------------------------ // Exit when window closes addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // Placement of window on screen setLocation(100, 50); pack(); setVisible(true); }
/** * Adds a component to the contentpane. * * @comp component to be added. */ protected void addComp(JComponent comp) { Container contentPane = getContentPane(); contentPane.add(comp, BorderLayout.CENTER); }
public void showPinObj(PushpinIF pobj, boolean on) { Component comp = (Component) pobj; if (comp == null) return; Container p = comp.getParent(); if (!on) { pobj.setPopup(false, true); if (p != null && p != tabbedPane) { p.remove(comp); p.validate(); p.repaint(); } if (popupComp == comp) popupComp = null; return; } if (popupComp != null) { if (popupComp != comp) { ((PushpinIF) popupComp).setPopup(false, true); p = popupComp.getParent(); if (p != null && p != tabbedPane) { p.remove(popupComp); } } popupComp = null; } /* if (!isShowing()) { return; } */ if (comp.isShowing()) { return; } Container p2 = null; p = pinPanel.getParent(); while (p != null) { if (p instanceof JLayeredPane) p2 = p; p = p.getParent(); } if (p2 == null) return; if (!isShowing()) { VnmrjIF vif = Util.getVjIF(); vif.raiseToolPanel(on); setVisible(true); } popupComp = comp; p = p2; pobj.setPopup(true, true); /* Point pt0 = p.getLocationOnScreen(); Point pt1 = getLocationOnScreen(); */ Point pt1 = getLocation(); Dimension dim = getSize(); int y0 = (int) ((float) dim.height * pobj.getRefY()); int h = (int) ((float) dim.height * pobj.getRefH()); int x = pt1.x + 2; int y = pt1.y + y0; p.add(comp, JLayeredPane.MODAL_LAYER); comp.setBounds(x, y, dim.width, dim.height - y0); ((JComponent) p).validate(); /* p.repaint(); */ }
private void initUi() { String history; String undo; String close; String abandon; String help; String string; char helpMnemonic; char historyMnemonic; char undoMnemonic; char closeMnemonic; char abandonMnemonic; DisplayOptions.addChangeListener(this); // setAlwaysOnTop(true); // Get text for buttons from properties/resource file history = Util.getLabel("blHistory", "Edit..."); undo = Util.getLabel("blUndo", "Undo"); close = Util.getLabel("blClose", "Close"); abandon = Util.getLabel("blAbandon", "Abandon"); help = Util.getLabel("blHelp", "Help"); // buttons undoButton = new JButton(undo); closeButton = new JButton(close); abandonButton = new JButton(abandon); helpButton = new JButton(help); // Create an ArrayList of menu items from properties file ArrayList<String> historyList = new ArrayList<String>(); historyList.add(Util.getLabel("mlHistReturnInitState", "Return to initial state")); historyList.add(Util.getLabel("mlHistMakeSnapshot", "Make a snapshot")); historyList.add(Util.getLabel("mlHistReturnToSnapshot", "Return to snapshot")); historyList.add(Util.getLabel("mlHistReturnToDefault", "Return to system defaults")); // Pop Button for history menu historyButton = new MPopButton(historyList); historyButton.setText(history); // Only set mnemonics if found. if (Util.labelExists("blmHelp")) { string = Util.getLabel("blmHelp"); helpMnemonic = string.charAt(0); helpButton.setMnemonic(helpMnemonic); } if (Util.labelExists("blmUndo")) { string = Util.getLabel("blmUndo"); undoMnemonic = string.charAt(0); undoButton.setMnemonic(undoMnemonic); } if (Util.labelExists("blmAbandon")) { string = Util.getLabel("blmAbandon"); abandonMnemonic = string.charAt(0); abandonButton.setMnemonic(abandonMnemonic); } if (Util.labelExists("blmClose")) { string = Util.getLabel("blmClose"); closeMnemonic = string.charAt(0); closeButton.setMnemonic(closeMnemonic); } if (Util.labelExists("blmHistory")) { string = Util.getLabel("blmHistory"); historyMnemonic = string.charAt(0); historyButton.setMnemonic(historyMnemonic); } helpButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { // Display Help if help file exists CSH_Util.displayCSHelp(dialogTitle); } }); // Make a panel to hold the buttons buttonPane = new JPanel(); // Put an empty border around the inside of the panel. buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 5, 10, 5)); buttonPane.setLayout(new SimpleH2Layout(SimpleH2Layout.CENTER)); // Add the buttons to the panel with space between buttons. buttonPane.add(historyButton); // buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(undoButton); // buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(closeButton); // buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(abandonButton); // buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(helpButton); // Put everything together, using the content pane's BorderLayout. Container contentPane = getContentPane(); contentPane.add(buttonPane, BorderLayout.SOUTH); setHistoryEnabled(false); // setCloseEnabled(false); setAbandonEnabled(false); setUndoEnabled(false); if (!CSH_Util.haveTopic(dialogTitle)) setHelpEnabled(false); // buttonPane.setVisible(false); // Add key listener to the whole dialog addKeyListener(this); // Make the frame fit its contents. // pack(); // nothing to pack. }
/** * Creates a new <code>AddPersonDialog</code> with a given owner <code>JFrame</code> and <code> * FamilyTree</code>. */ public AddPersonDialog(JFrame owner, FamilyTree tree) { super(owner, "Add New Person", true /* modal */); Container pane = this.getContentPane(); pane.setLayout(new BorderLayout()); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new GridLayout(0, 2)); Border infoBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5); infoPanel.setBorder(infoBorder); infoPanel.add(new JLabel("id:")); final JTextField idField = new JTextField(); infoPanel.add(idField); final ButtonGroup group = new ButtonGroup(); final JRadioButton male = new JRadioButton("male", true); group.add(male); infoPanel.add(male); final JRadioButton female = new JRadioButton("female"); group.add(female); infoPanel.add(female); infoPanel.add(new JLabel("First name:")); final JTextField firstNameField = new JTextField(); infoPanel.add(firstNameField); infoPanel.add(new JLabel("Middle name:")); final JTextField middleNameField = new JTextField(); infoPanel.add(middleNameField); infoPanel.add(new JLabel("Last name:")); final JTextField lastNameField = new JTextField(); infoPanel.add(lastNameField); infoPanel.add(new JLabel("Date of Birth:")); final JTextField dobField = new JTextField(); infoPanel.add(dobField); infoPanel.add(new JLabel("Date of Death:")); final JTextField dodField = new JTextField(); infoPanel.add(dodField); infoPanel.add(new JLabel("Father:")); JPanel fatherPanel = new JPanel(); fatherPanel.setLayout(new FlowLayout()); final JTextField fatherText = new JTextField("Click to choose"); fatherText.setEditable(false); fatherText.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { // Pop up a PersonChooseDialog, place name in TextField System.out.println("Clicked father"); } }); fatherPanel.add(fatherText); infoPanel.add(fatherPanel); infoPanel.add(new JLabel("Mother:")); JPanel motherPanel = new JPanel(); motherPanel.setLayout(new FlowLayout()); final JTextField motherText = new JTextField("Click to choose"); motherText.setEditable(false); motherText.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { // Pop up a PersonChooseDialog, place name in TextField System.out.println("Clicked mother"); } }); motherPanel.add(motherText); infoPanel.add(motherPanel); pane.add(infoPanel, BorderLayout.NORTH); // "Add" and "Cancel" buttons JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); JButton addButton = new JButton("Add"); addButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // Create a new person based on the information entered in // this dialog int id = 0; try { id = Integer.parseInt(idField.getText()); } catch (NumberFormatException ex) { error("Invalid id: " + idField.getText()); return; } String text = null; text = dobField.getText(); Date dob = null; if (text != null && !text.equals("")) { dob = parseDate(dobField.getText()); if (dob == null) { // Parse error return; } } text = dodField.getText(); Date dod = null; if (text != null && !text.equals("")) { dod = parseDate(dodField.getText()); if (dod == null) { // Parse error return; } } Person.Gender gender; if (group.getSelection().equals(male)) { gender = Person.MALE; } else { gender = Person.FEMALE; } // Okay, everything parsed alright newPerson = new Person(id, gender); newPerson.setFirstName(firstNameField.getText()); newPerson.setMiddleName(middleNameField.getText()); newPerson.setLastName(lastNameField.getText()); newPerson.setDateOfBirth(dob); newPerson.setDateOfDeath(dod); if (mother != null) { newPerson.setMother(mother); } if (father != null) { newPerson.setFather(father); } // We're all happy AddPersonDialog.this.dispose(); } }); buttonPanel.add(addButton); buttonPanel.add(Box.createHorizontalGlue()); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { // Read my lips, no new Person! AddPersonDialog.this.newPerson = null; AddPersonDialog.this.dispose(); } }); buttonPanel.add(cancelButton); buttonPanel.add(Box.createHorizontalGlue()); pane.add(buttonPanel, BorderLayout.SOUTH); }
/** Initializes the applet SVGApplet */ public void init() { // Set look and feel // ----------------- try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable e) { // Do nothing. // If we can't set the desired look and feel, UIManager does // automaticaly the right thing for us. } // Display copyright info while we are loading the data // ---------------------------------------------------- Container c = getContentPane(); c.setLayout(new BoxLayout(c, BoxLayout.Y_AXIS)); String[] labels = getAppletInfo().split("\n"); // Strings.split(getAppletInfo(), '\n'); for (int i = 0; i < labels.length; i++) { c.add(new JLabel((labels[i].length() == 0) ? " " : labels[i])); } // We load the data using a worker thread // -------------------------------------- new Worker() { public Object construct() { Object result = null; InputStream in = null; try { // Try to read the data using all known input formats. Drawing drawing = createDrawing(); for (InputFormat fmt : drawing.getInputFormats()) { try { if (getParameter("data") != null) { in = new ByteArrayInputStream(getParameter("data").getBytes("UTF8")); } else if (getParameter("datafile") != null) { URL url = new URL(getDocumentBase(), getParameter("datafile")); in = url.openConnection().getInputStream(); } if (in != null) { fmt.read(in, drawing); result = drawing; break; } } catch (IOException e) { result = e; } } } catch (Throwable t) { result = t; } finally { if (in != null) { try { in.close(); } catch (IOException ex) { // ignore } } } return result; } public void finished(Object result) { if (result instanceof Throwable) { ((Throwable) result).printStackTrace(); } Container c = getContentPane(); c.setLayout(new BorderLayout()); c.removeAll(); c.add(drawingPanel = new SVGDrawingPanel()); initComponents(); if (result != null) { if (result instanceof Drawing) { setDrawing((Drawing) result); } else if (result instanceof Throwable) { getDrawing().add(new SVGTextFigure(result.toString())); ((Throwable) result).printStackTrace(); } } c.validate(); } }.start(); }
/** * The consturctor Constructor instantiates all the panels, convertible value instance, and the * frame. And adds the panels to the frame. And sets a proper size for the frame. */ public HappyHackingConverter() { CFrame frame = new CFrame(); frame.setBackground(white); ConvertibleValue temperatures = new ConvertibleValue(); ConvertibleValue distances = new ConvertibleValue(); ConvertibleValue weights = new ConvertibleValue(); GridBagLayout leftSideLayout = new GridBagLayout(); JPanel leftSide = new JPanel(leftSideLayout); leftSide.setBackground(white); GridBagLayout rightSideLayout = new GridBagLayout(); JPanel rightSide = new JPanel(rightSideLayout); rightSide.setBackground(white); GridBagConstraints metricTemperatureConstraints = new GridBagConstraints(); metricTemperatureConstraints.gridx = 0; metricTemperatureConstraints.gridy = 0; metricTemperatureConstraints.weighty = 0.1; metricTemperatureConstraints.weightx = 1; metricTemperatureConstraints.fill = GridBagConstraints.BOTH; metricTemperatureConstraints.anchor = GridBagConstraints.FIRST_LINE_START; JPanel metricTemperaturePanel = new TemperaturePanel(frame, temperatures, TemperatureScales.CENTIGRADE); leftSideLayout.setConstraints(metricTemperaturePanel, metricTemperatureConstraints); leftSide.add(metricTemperaturePanel); GridBagConstraints metricDistancesPanelConstraints = new GridBagConstraints(); metricDistancesPanelConstraints.gridx = 0; metricDistancesPanelConstraints.gridy = 1; metricDistancesPanelConstraints.weighty = 0.3; metricDistancesPanelConstraints.weightx = 1; metricDistancesPanelConstraints.fill = GridBagConstraints.BOTH; metricDistancesPanelConstraints.anchor = GridBagConstraints.FIRST_LINE_START; JPanel metricDistancesPanel = new MetricDistancesPanel(frame, distances); leftSideLayout.setConstraints(metricDistancesPanel, metricDistancesPanelConstraints); leftSide.add(metricDistancesPanel); GridBagConstraints fahrenheitConstraints = new GridBagConstraints(); fahrenheitConstraints.gridx = 0; fahrenheitConstraints.gridy = 0; fahrenheitConstraints.weighty = 0.1; fahrenheitConstraints.weightx = 1; fahrenheitConstraints.fill = GridBagConstraints.BOTH; fahrenheitConstraints.anchor = GridBagConstraints.FIRST_LINE_START; JPanel fahrenheitTemperaturePanel = new TemperaturePanel(frame, temperatures, TemperatureScales.FAHRENHEIT); rightSideLayout.setConstraints(fahrenheitTemperaturePanel, fahrenheitConstraints); rightSide.add(fahrenheitTemperaturePanel); GridBagConstraints imperialDistancesPanelConstraints = new GridBagConstraints(); imperialDistancesPanelConstraints.gridx = 0; imperialDistancesPanelConstraints.gridy = 1; imperialDistancesPanelConstraints.weighty = 0.3; imperialDistancesPanelConstraints.weightx = 1; imperialDistancesPanelConstraints.fill = GridBagConstraints.BOTH; imperialDistancesPanelConstraints.anchor = GridBagConstraints.FIRST_LINE_START; JPanel imperialDistancesPanel = new ImperialDistancesPanel(frame, distances); rightSideLayout.setConstraints(imperialDistancesPanel, imperialDistancesPanelConstraints); rightSide.add(imperialDistancesPanel); GridBagConstraints metricWeightsConstraints = new GridBagConstraints(); metricWeightsConstraints.gridx = 0; metricWeightsConstraints.gridy = 2; metricWeightsConstraints.weighty = 0.6; metricWeightsConstraints.weightx = 1; metricWeightsConstraints.fill = GridBagConstraints.BOTH; metricWeightsConstraints.anchor = GridBagConstraints.FIRST_LINE_START; MetricWeightsPanel metricWeightsPanel = new MetricWeightsPanel(frame, weights); leftSideLayout.setConstraints(metricWeightsPanel, metricWeightsConstraints); leftSide.add(metricWeightsPanel); GridBagConstraints imperialWeightsConstraints = new GridBagConstraints(); imperialWeightsConstraints.gridx = 0; imperialWeightsConstraints.gridy = 2; imperialWeightsConstraints.weighty = 0.6; imperialWeightsConstraints.weightx = 1; imperialWeightsConstraints.fill = GridBagConstraints.BOTH; imperialWeightsConstraints.anchor = GridBagConstraints.FIRST_LINE_START; ImperialWeightsPanel imperialWeightsPanel = new ImperialWeightsPanel(frame, weights); rightSideLayout.setConstraints(imperialWeightsPanel, imperialWeightsConstraints); rightSide.add(imperialWeightsPanel); CSplit split = new CSplit(JSplitPane.HORIZONTAL_SPLIT, true, leftSide, rightSide); Container contentPane = frame.getContentPane(); contentPane.add(split); frame.validate(); frame.pack(); frame.setSize(600, 997); split.setResizeWeight(0.5); split.setDividerLocation(0.5); } // end of HappyHackingConverter constructor
static void buildGUI() { // Need this size to balance axes. frame.setSize(520, 690); frame.setTitle("DrawTool"); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Container cPane = frame.getContentPane(); // Status label on top. Unused for now. statusLabel.setOpaque(true); statusLabel.setBackground(Color.white); cPane.add(statusLabel, BorderLayout.NORTH); // Build the input/output elements at the bottom. JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createLineBorder(Color.black)); panel.setBackground(inputPanelColor); panel.setLayout(new GridLayout(2, 1)); panel.add(outputLabel); JPanel bottomPanel = new JPanel(); bottomPanel.setBackground(inputPanelColor); bottomPanel.add(inputField); bottomPanel.add(new JLabel(" ")); JButton enterButton = new JButton("Enter"); enterButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent a) { hasEntered = true; } }); bottomPanel.add(enterButton); panel.add(bottomPanel); if (!sequencingOn) { cPane.add(panel, BorderLayout.SOUTH); } // Drawing in the center. drawArea = new DrawTool(); if (sequencingOn) { frame.addKeyListener( new KeyAdapter() { public void keyTyped(KeyEvent e) { handleKeyTyped(e); } }); } cPane.add(drawArea, BorderLayout.CENTER); drawArea.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { handleMouseClick(e); } public void mouseReleased(MouseEvent e) { handleMouseReleased(e); } }); drawArea.addMouseMotionListener( new MouseMotionAdapter() { public void mouseDragged(MouseEvent e) { handleMouseDragged(e); } }); }
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Open Source Project license - unknown ResourceBundle bundle = ResourceBundle.getBundle("InformationDialog"); JPanel dialogPane = new JPanel(); JPanel contentPanel = new JPanel(); iconLabel = new JLabel(); pathLabel = new JLabel(); JLabel labelFrom = new JLabel(); fieldFrom = new JTextField(); JLabel labelSize = new JLabel(); fieldSize = new JTextField(); JLabel labelDescription = new JLabel(); JScrollPane scrollPane1 = new JScrollPane(); descriptionArea = ComponentFactory.getTextArea(); JPanel optionsPanel = new JPanel(); JLabel saveToLabel = new JLabel(); comboPath = new JComboBox(); btnSelectPath = new JButton(); progressBar = new JProgressBar(); JLabel labelRemaining = new JLabel(); remainingLabel = new JLabel(); JLabel labelEstimateTime = new JLabel(); estTimeLabel = new JLabel(); JLabel labelCurrentSpeed = new JLabel(); currentSpeedLabel = new JLabel(); JLabel labelAverageSpeed = new JLabel(); avgSpeedLabel = new JLabel(); JXButtonPanel buttonBar = new JXButtonPanel(); okButton = new JButton(); cancelButton = new JButton(); CellConstraints cc = new CellConstraints(); // ======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); // ======== dialogPane ======== { dialogPane.setBorder(Borders.DIALOG); dialogPane.setLayout(new BorderLayout()); // ======== contentPanel ======== { // ---- iconLabel ---- iconLabel.setText(bundle.getString("iconLabel.text")); // ---- pathLabel ---- pathLabel.setText(bundle.getString("pathLabel.text")); pathLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelFrom ---- labelFrom.setText(bundle.getString("labelFrom.text")); // ---- fieldFrom ---- fieldFrom.setBorder(null); fieldFrom.setOpaque(false); fieldFrom.setText(bundle.getString("fieldFrom.text")); // ---- labelSize ---- labelSize.setText(bundle.getString("labelSize.text")); // ---- fieldSize ---- fieldSize.setBorder(null); fieldSize.setOpaque(false); // ---- labelDescription ---- labelDescription.setText(bundle.getString("labelDescription.text")); // ======== scrollPane1 ======== { scrollPane1.setViewportView(descriptionArea); } // ======== optionsPanel ======== { // ---- saveToLabel ---- saveToLabel.setText(bundle.getString("saveToLabel.text")); saveToLabel.setLabelFor(comboPath); // ---- comboPath ---- comboPath.setEditable(true); // ---- btnSelectPath ---- btnSelectPath.setText(bundle.getString("btnSelectPath.text")); PanelBuilder optionsPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("default")), optionsPanel); optionsPanelBuilder.add(saveToLabel, cc.xy(1, 1)); optionsPanelBuilder.add(comboPath, cc.xy(3, 1)); optionsPanelBuilder.add(btnSelectPath, cc.xy(5, 1)); } // ---- progressBar ---- progressBar.setFont(new Font("Tahoma", Font.BOLD, 16)); // ---- labelRemaining ---- labelRemaining.setText(bundle.getString("labelRemaining.text")); // ---- remainingLabel ---- remainingLabel.setText(bundle.getString("remainingLabel.text")); remainingLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelEstimateTime ---- labelEstimateTime.setText(bundle.getString("labelEstimateTime.text")); // ---- estTimeLabel ---- estTimeLabel.setText(bundle.getString("estTimeLabel.text")); estTimeLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelCurrentSpeed ---- labelCurrentSpeed.setText(bundle.getString("labelCurrentSpeed.text")); // ---- currentSpeedLabel ---- currentSpeedLabel.setText(bundle.getString("currentSpeedLabel.text")); currentSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); // ---- labelAverageSpeed ---- labelAverageSpeed.setText(bundle.getString("labelAverageSpeed.text")); // ---- avgSpeedLabel ---- avgSpeedLabel.setText(bundle.getString("avgSpeedLabel.text")); avgSpeedLabel.setFont(new Font("Tahoma", Font.BOLD, 12)); PanelBuilder contentPanelBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(Sizes.dluX(49)), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(min;70dlu)") }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, new RowSpec( RowSpec.FILL, Sizes.bounded(Sizes.PREFERRED, Sizes.dluY(40), Sizes.dluY(50)), FormSpec.DEFAULT_GROW), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("fill:max(pref;20dlu)"), FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }), contentPanel); contentPanelBuilder.add(iconLabel, cc.xywh(1, 1, 1, 5)); contentPanelBuilder.add(pathLabel, cc.xywh(3, 1, 7, 1)); contentPanelBuilder.add(labelFrom, cc.xy(3, 3)); contentPanelBuilder.add(fieldFrom, cc.xywh(5, 3, 5, 1)); contentPanelBuilder.add(labelSize, cc.xy(3, 5)); contentPanelBuilder.add(fieldSize, cc.xywh(5, 5, 3, 1)); contentPanelBuilder.add(labelDescription, cc.xy(1, 7)); contentPanelBuilder.add(scrollPane1, cc.xywh(1, 9, 9, 1)); contentPanelBuilder.add(optionsPanel, cc.xywh(1, 11, 9, 1)); contentPanelBuilder.add(progressBar, cc.xywh(1, 13, 9, 1)); contentPanelBuilder.add(labelRemaining, cc.xy(1, 15)); contentPanelBuilder.add(remainingLabel, cc.xywh(3, 15, 3, 1)); contentPanelBuilder.add(labelEstimateTime, cc.xy(7, 15)); contentPanelBuilder.add(estTimeLabel, cc.xy(9, 15)); contentPanelBuilder.add(labelCurrentSpeed, cc.xy(1, 17)); contentPanelBuilder.add(currentSpeedLabel, cc.xywh(3, 17, 3, 1)); contentPanelBuilder.add(labelAverageSpeed, cc.xy(7, 17)); contentPanelBuilder.add(avgSpeedLabel, cc.xy(9, 17)); } dialogPane.add(contentPanel, BorderLayout.CENTER); // ======== buttonBar ======== { buttonBar.setBorder(new EmptyBorder(12, 0, 0, 0)); // ---- okButton ---- okButton.setText(bundle.getString("okButton.text")); // ---- cancelButton ---- cancelButton.setText(bundle.getString("cancelButton.text")); PanelBuilder buttonBarBuilder = new PanelBuilder( new FormLayout( new ColumnSpec[] { new ColumnSpec(ColumnSpec.FILL, Sizes.DEFAULT, FormSpec.DEFAULT_GROW), FormSpecs.UNRELATED_GAP_COLSPEC, ColumnSpec.decode("max(pref;55dlu)"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC }, RowSpec.decodeSpecs("fill:pref")), buttonBar); ((FormLayout) buttonBar.getLayout()).setColumnGroups(new int[][] {{3, 5}}); buttonBarBuilder.add(okButton, cc.xy(3, 1)); buttonBarBuilder.add(cancelButton, cc.xy(5, 1)); } dialogPane.add(buttonBar, BorderLayout.SOUTH); } contentPane.add(dialogPane, BorderLayout.CENTER); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents }