public PropertiesAction() { super("Properties", null); // putValue(SHORT_DESCRIPTION, desc); // putValue(MNEMONIC_KEY, mnemonic); String[] labels = { "Name", "Entry time", "Exit time", "Entry cpu", "Exit cpu", "This", "Result", "Parameters"}; propsPanel = new JPanel(new SpringLayout()); for (int i = 0; i < labels.length; i++) { JLabel l = new JLabel(labels[i] + ": ", JLabel.TRAILING); propsPanel.add(l); JTextField textField = new JTextField(10); l.setLabelFor(textField); propsPanel.add(textField); propsMap.put(labels[i], textField); } SpringUtilities.makeCompactGrid(propsPanel, labels.length, 2, 5, 5, 5, 5); }
public TemplateEditor(GrammarModel grammar) { super(grammar, new SpringLayout()); setBackground(ExplorationDialog.INFO_BG_COLOR); addName(); addExplanation(); add(Box.createRigidArea(new Dimension(0, 6))); addKeyword(); addNrArguments(); add(Box.createRigidArea(new Dimension(0, 6))); for (String argName : Template.this.argumentNames) { addArgument(argName); } SpringUtilities.makeCompactGrid(this, 6 + Template.this.argumentNames.length, 1, 2, 2, 0, 0); refresh(); }
public GroupBox(final AbstractButton b) { button = b; button.addItemListener(this); button.setOpaque(true); button.setBackground(this.getBackground()); final int buttonHeight = button.getPreferredSize().height; inner = new JPanel(); inner.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(buttonHeight / 2, 5, 5, 5))); final SpringLayout layout = new SpringLayout(); super.setLayout(layout); super.add(button); super.add(inner); layout.putConstraint(SpringLayout.WEST, button, 10, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, inner, buttonHeight / 2, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.WEST, inner, 0, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.SOUTH, this, 0, SpringLayout.SOUTH, inner); layout.putConstraint(SpringLayout.EAST, this, 0, SpringLayout.EAST, inner); }
protected void prepareControls() { if(frame != null) { frame.setVisible(false); } frame = new JFrame("Mixing : Dropdown Overlapping test"); frame.setLayout(new SpringLayout()); frame.setSize(200, 200); popup = new JPopupMenu(); ActionListener menuListener = new ActionListener() { public void actionPerformed(ActionEvent event) { lwClicked = true; } }; JMenuItem item; for (int i = 0; i < petStrings.length; i++) { popup.add(item = new JMenuItem(petStrings[i])); item.addActionListener(menuListener); } propagateAWTControls(frame); frame.setVisible(true); loc = frame.getContentPane().getLocationOnScreen(); }
private JPanel createComponent() { final ValueValidator validator = new ValueValidator(this.minimum, this.maximum); final DoubleField minimumField = createDoubleField(this.minimumValueModel, this.minimumValidationModel, validator); final DoubleField maximumField = createDoubleField(this.maximumValueModel, this.maximumValidationModel, validator); @SuppressWarnings("serial") final JPanel panel = new JPanel(new SpringLayout()) { @Override public void requestFocus() { minimumField.getComponent().requestFocus(); } }; panel.add(minimumField.getComponent()); panel.add(maximumField.getComponent()); SpringLayoutUtilities.makeCompactGrid(panel, 2, 1, 0, 0, 6, 0); return panel; }
@Override public JComponent getComponent() { if (this.panel == null) { final IComponentContainer container = this.container; final JPanel component = new JPanel(new SpringLayout()); this.panel = new JPanel(new BorderLayout()) { @Override public void setEnabled(final boolean enabled) { super.setEnabled(enabled); container.setEnabled(enabled); } }; this.panel.add(component, BorderLayout.NORTH); this.container.addTo(component); SpringLayoutUtilities.makeCompactGrid(component, container.getColumnCount(), container.getRowCount(), 4, 4, 6, 6); } return this.panel; }
public Profile_Item_GUI(Profile_Item profile) throws IOException{ URL img1 = Profile_Item_GUI.this.getClass().getResource("../quadicon.png"); Image g1 = ImageIO.read(img1); g1 = g1.getScaledInstance(80, 80, Image.SCALE_SMOOTH); ImageIcon icon1 = new ImageIcon(g1); l3 = new JLabel(icon1); p2.setBorder(BorderFactory.createEtchedBorder()); p2.add(l3); l1.setText(l1.getText()+" "+profile.getTitle()); spring.putConstraint(SpringLayout.WEST,l1,4,SpringLayout.WEST,p3); p3.add(l1); l2.setText(l2.getText()+" "+profile.getDescription()); spring.putConstraint(SpringLayout.NORTH,l2,16,SpringLayout.NORTH,p3); spring.putConstraint(SpringLayout.WEST,l2,4,SpringLayout.WEST,p3); spring.putConstraint(SpringLayout.EAST,l2,-4,SpringLayout.WEST,b); p3.add(l2); spring.putConstraint(SpringLayout.EAST,b,-16,SpringLayout.EAST,p3); spring.putConstraint(SpringLayout.NORTH,b,32,SpringLayout.NORTH,p3); p3.add(b); p1.add(p3,BorderLayout.CENTER); p1.add(p2,BorderLayout.WEST); add(p1); setLayout(new GridLayout(1,1)); this.setMinimumSize(new Dimension(1000,80)); this.setMaximumSize(new Dimension(9000,80)); }
private JPanel createInputPanelArea() { //Create and populate the panel. JPanel springPanel = new JPanel(new SpringLayout()); springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); JLabel lName = new JLabel("Sensor Type: "); springPanel.add(lName); sensorType = new JTextField(); lName.setLabelFor(sensorType); springPanel.add(sensorType); //Lay out the panel. SpringUtilities.makeCompactGrid(springPanel, 1, 2, //rows, columns 6, 6, //initX, initY 6, 6); //xPad, yPad return springPanel; }
private JPanel createInputPanelArea() { //Create and populate the panel. JPanel springPanel = new JPanel(new SpringLayout()); springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); JLabel lName = new JLabel("Name: "); springPanel.add(lName); tfName = new JTextField(); lName.setLabelFor(tfName); springPanel.add(tfName); //Lay out the panel. SpringUtilities.makeCompactGrid(springPanel, 1, 2, //rows, columns 6, 6, //initX, initY 6, 6); //xPad, yPad return springPanel; }
private JPanel createInputPanelArea() { //Create and populate the panel. JPanel springPanel = new JPanel(new SpringLayout()); springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); JLabel lName = new JLabel("Name: "); springPanel.add(lName); actuatorName = new JTextField(); lName.setLabelFor(actuatorName); springPanel.add(actuatorName); JLabel lType = new JLabel("Actuator Type : "); springPanel.add(lType); actuatorType = new JTextField(); lName.setLabelFor(actuatorType); springPanel.add(actuatorType); //Lay out the panel. SpringUtilities.makeCompactGrid(springPanel, 2, 2, //rows, columns 6, 6, //initX, initY 6, 6); //xPad, yPad return springPanel; }
private JPanel createInputPanelArea() { //Create and populate the panel. JPanel springPanel = new JPanel(new SpringLayout()); springPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15)); JLabel lName = new JLabel("Sensor Type: "); springPanel.add(lName); actuatorType = new JTextField(); lName.setLabelFor(actuatorType); springPanel.add(actuatorType); //Lay out the panel. SpringUtilities.makeCompactGrid(springPanel, 1, 2, //rows, columns 6, 6, //initX, initY 6, 6); //xPad, yPad return springPanel; }
public KautotuSartzekoPanela() { this.setLayout(new SpringLayout()); this.erabiltzailea = new JLabel("Erabiltzaile izena:", SwingConstants.TRAILING); this.erabiltzaileaField = new JTextField(); this.erabiltzaileaField.setName("Erabiltzailea Field"); this.erabiltzaileaField.addActionListener(gureAE -> AlKaboom.getAlKaboom().getUI().getKautotu() .getKautotuPanela().taulaEguneratu(this.erabiltzaileaField.getText())); this.erabiltzaileaField.addKeyListener(this); this.erabiltzailea.setLabelFor(erabiltzaileaField); this.zailtasuna = new JLabel("Zailtasuna:", SwingConstants.TRAILING); aukerakArray = new String[] { "Erreza", "Normala", "Zaila", "Custom..." }; this.aukerakEraiki(0); this.zailtasuna.setLabelFor(aukerak); this.sartu = new JButton("Sartu"); this.sartu.setName("Sartu"); this.sartu.setEnabled(false); this.sartu.addActionListener(gureAE -> this.datuakGorde()); this.aukerazkoa = new JButton("Zailtasuna Aukeratu..."); this.aukerazkoa.setEnabled(false); this.aukerazkoa.setName("Zailtasuna Sartu"); this.aukerazkoa.addActionListener(gureAE -> AlKaboom.getAlKaboom().getUI().getKautotu().zailtasunaIpini()); this.guztiaGehitu(); }
public EmployeeFrame(String title) { super(title); contentPanel.setLayout(new GridLayout(0, 3, 0, 0)); JPanel panel = new JPanel(); contentPanel.add(panel); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); caretakerButton = new JButton("Caretaker"); slPanel.putConstraint(SpringLayout.NORTH, caretakerButton, 65, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, caretakerButton, 93, SpringLayout.WEST, pan); pan.add(caretakerButton); JPanel rightPanel = new JPanel(); contentPanel.add(rightPanel); setVisible(true); }
@Override protected void createCellSpecificComponents() { try { Dimension dim2 = new Dimension(35, 35); JToggleButton tglInfinite = gettglInfinite(dim2); JToggleButton tglBound = getBoundButon(dim2); JPanel pnlBoundOrInfinite = new JPanel(new SpringLayout()); pnlBoundOrInfinite.add(tglInfinite); pnlBoundOrInfinite.add(tglBound); if (getPlace().isBounded()) { tglBound.setEnabled(false); tglInfinite.setEnabled(true); } if (!getPlace().isBounded()) { tglBound.setEnabled(true); tglInfinite.setEnabled(false); } SpringUtilities.makeCompactGrid(pnlBoundOrInfinite, 1, 2, 1, 1, 1, 1); mainPanel().add(pnlBoundOrInfinite); } catch (Exception e) { JOptionPane.showMessageDialog(this, "Buttons could not be added. \nReason: " + e.getMessage(), "" + e.getClass(), JOptionPane.ERROR); } }
@Override protected JPanel addToNorth() { JPanel p = new JPanel(); nameField = new JTextField(); p.setLayout(new SpringLayout()); p.add(prepareFieldLabel("New data object name")); p.add(nameField); // lay out the panel SpringUtilities.makeCompactGrid(p, (p.getComponentCount() / 2), 2, // rows, cols 0, 0, // initX, initY 5, 10); //xPad, yPad return p; }
private JPanel getActivityClassificationPanel() { if (subjectDescriptorPanel == null) { subjectDescriptorPanel = new JPanel(new SpringLayout()); for (String activity : getDialogObject().getACModel().getContext().getActivities()) { JLabel label = new JLabel(activity, JLabel.TRAILING); label.setToolTipText(activity); label.setPreferredSize(new Dimension(140, label.getPreferredSize().height)); subjectDescriptorPanel.add(label); SubjectDescriptorBox box = new SubjectDescriptorBox(activity); box.setSelectedItem(getDialogObject().getSubjectDescriptor(activity)); subjectDescriptorPanel.add(box); subjectDescriptorPanel.add(Box.createHorizontalGlue()); } SpringUtilities.makeCompactGrid(subjectDescriptorPanel, getDialogObject().getACModel().getContext().getActivities().size(), 3, 0, 0, 0, 0); } return subjectDescriptorPanel; }
/** * Default constructor. */ FloatingPanel() { setBackground(new Color(0, 0, 0, 0)); controller = new FloatingPanelController(this); SpringLayout layout = new SpringLayout(); this.setLayout(layout); caption = new JLabel("Test"); caption.setBackground(SHADED); caption.setForeground(Color.WHITE); this.add(caption); contentPane = new JPanel(); contentPane.setBackground(CLEAR); contentPane.setForeground(Color.WHITE); this.add(contentPane); layout.putConstraint(SpringLayout.WEST, caption, 3, SpringLayout.WEST, this); layout.putConstraint(SpringLayout.NORTH, caption, 3, SpringLayout.NORTH, this); layout.putConstraint(SpringLayout.NORTH, contentPane, 3, SpringLayout.SOUTH, caption); layout.putConstraint(SpringLayout.WEST, contentPane, 3, SpringLayout.WEST, this); }
/** * * @param title * The title of the frame. */ public ListFrame(final String title) { super(title); contentPanel.setLayout(new GridLayout(0, 1, 0, 0)); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); Animal = new JButton("Animal"); slPanel.putConstraint(SpringLayout.NORTH, Animal, 0, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, Animal, 0, SpringLayout.WEST, pan); pan.add(Animal); Employee = new JButton("Employee"); slPanel.putConstraint(SpringLayout.NORTH, Employee, 0, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, Employee, 78, SpringLayout.WEST, pan); pan.add(Employee); JPanel panel_2 = new JPanel(); contentPanel.add(panel_2); setVisible(true); }
public MainMenuFrame(String title) { super(title); contentPanel.setLayout(new GridLayout(0, 3, 0, 0)); JPanel panel = new JPanel(); // adding empty panel to fill grid layout contentPanel.add(panel); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); btnAdd = new JButton("Add"); slPanel.putConstraint(SpringLayout.NORTH, btnAdd, 65, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, btnAdd, 93, SpringLayout.WEST, pan); pan.add(btnAdd); btnList = new JButton("List"); slPanel.putConstraint(SpringLayout.NORTH, btnList, 150, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, btnList, 94, SpringLayout.WEST, pan); pan.add(btnList); btnSaveAndExit = new JButton("Save and Exit"); slPanel.putConstraint(SpringLayout.NORTH, btnSaveAndExit, 264, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, btnSaveAndExit, 69, SpringLayout.WEST, pan); pan.add(btnSaveAndExit); JPanel panel_2 = new JPanel(); contentPanel.add(panel_2); setVisible(true); }
public UrlGenerator() { SpringLayout layout = new SpringLayout(); JLabel label = new JLabel("URL: "); txtUrl.setText("http://"); panel.setLayout(layout); panel.add(label); panel.add(txtUrl); layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, panel); layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.WEST, txtUrl, 5, SpringLayout.EAST, label); layout.putConstraint(SpringLayout.NORTH, txtUrl, 5, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.EAST, txtUrl, -5, SpringLayout.EAST, panel); }
public PhoneNumberGenerator() { SpringLayout layout = new SpringLayout(); JLabel label = new JLabel("Phone Number: "); panel.setLayout(layout); panel.add(label); panel.add(txtPhoneNumber); layout.putConstraint(SpringLayout.WEST, label, 5, SpringLayout.WEST, panel); layout.putConstraint(SpringLayout.NORTH, label, 5, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.WEST, txtPhoneNumber, 5, SpringLayout.EAST, label); layout.putConstraint(SpringLayout.NORTH, txtPhoneNumber, 5, SpringLayout.NORTH, panel); layout.putConstraint(SpringLayout.EAST, panel, 5, SpringLayout.EAST, txtPhoneNumber); }
public AddFrame(String title) { super(title); contentPanel.setLayout(new GridLayout(0, 3, 0, 0)); JPanel panel = new JPanel(); contentPanel.add(panel); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); animalButton = new JButton("Animal"); slPanel.putConstraint(SpringLayout.NORTH, animalButton, 65, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, animalButton, 93, SpringLayout.WEST, pan); pan.add(animalButton); employeeButton = new JButton("Employee"); slPanel.putConstraint(SpringLayout.NORTH, employeeButton, 100, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, employeeButton, 93, SpringLayout.WEST, pan); pan.add(employeeButton); JPanel rightPanel = new JPanel(); contentPanel.add(rightPanel); setVisible(true); }
public void setUpGui() { pnlProperty = new JPanel(new SpringLayout()); pnlProperty.add(getLabelHeadline()); pnlProperty.add(new JPopupMenu.Separator()); pnlProperty.add(getButtonErrorDetails()); pnlProperty.add(new JPopupMenu.Separator()); pnlProperty.add(getPanelSpecificFields()); SpringUtilities.makeCompactGrid(getPanelSpecificFields(), getPanelSpecificFields().getComponentCount(), 1, 0, 0, 0, 0); pnlProperty.add(new JPopupMenu.Separator()); int componentCount = pnlProperty.getComponentCount(); SpringUtilities.makeCompactGrid(pnlProperty, componentCount, 1, 0, 0, 0, 0); add(pnlProperty, BorderLayout.PAGE_START); setMinimumSize(new Dimension((int) pnlProperty.getSize().getWidth(), (int) (lineHeight*componentCount))); }
private JPanel getAdditionalPanel(){ SpringLayout layout = new SpringLayout(); additionalPanel = new JPanel(new BorderLayout()); additionalPanel.setPreferredSize(new Dimension(250,200)); JPanel topPanel = new JPanel(layout); additionalPanel.add(topPanel, BorderLayout.NORTH); JLabel stereotypeLabel = new JLabel("Stereotype "); stereotype = new ItComboBox(); stereotype.setEditable(true); stereotype.addItem(""); stereotype.addItem("agent"); stereotype.addItem("utility"); stereotype.addItemListener(this); topPanel.add(stereotypeLabel); topPanel.add(stereotype); SpringUtilities.makeCompactGrid(topPanel,1,2,5,5,5,5); return additionalPanel; }
public AFrame(String title) { super(title); contentPanel.setLayout(new GridLayout(0, 3, 0, 0)); JPanel panel = new JPanel(); contentPanel.add(panel); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); animalButton = new JButton("Animal"); slPanel.putConstraint(SpringLayout.NORTH, animalButton, 65, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, animalButton, 93, SpringLayout.WEST, pan); pan.add(animalButton); employeeButton = new JButton("Employee"); slPanel.putConstraint(SpringLayout.NORTH, employeeButton, 100, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, employeeButton, 93, SpringLayout.WEST, pan); pan.add(employeeButton); JPanel rightPanel = new JPanel(); contentPanel.add(rightPanel); setVisible(true); }
/** * * @param title * The title of the frame. */ public EmployeeFrame(final String title) { super(title); contentPanel.setLayout(new GridLayout(0, 1, 0, 0)); JPanel pan = new JPanel(); contentPanel.add(pan); SpringLayout slPanel = new SpringLayout(); pan.setLayout(slPanel); Caretaker = new JButton("Caretaker"); slPanel.putConstraint(SpringLayout.NORTH, Caretaker, 180, SpringLayout.NORTH, pan); slPanel.putConstraint(SpringLayout.WEST, Caretaker, 280, SpringLayout.WEST, pan); pan.add(Caretaker); JPanel panel_2 = new JPanel(); contentPanel.add(panel_2); setVisible(true); }
void setHolder(Component c) { holder.removeAll(); SpringLayout l = (SpringLayout) holder.getLayout(); l.putConstraint(EAST, c, 0, EAST, holder); l.putConstraint(WEST, c, 0, WEST, holder); l.putConstraint(NORTH, c, 0, NORTH, holder); l.putConstraint(SOUTH, c, 0, SOUTH, holder); holder.add(c); revalidate(); }
private static SpringLayout.Constraints getConstraintsForCell( int row, int col, Container parent, int cols) { SpringLayout layout = (SpringLayout) parent.getLayout(); Component c = parent.getComponent(row * cols + col); return layout.getConstraints(c); }
protected void initComponents() { setLayout(new BorderLayout(10, 10)); dialogPanel = new JPanel(new SpringLayout()); dialogPanel.setBorder(BorderFactory.createTitledBorder(new EtchedBorder(), "Select Member Classes")); dialogPanel.setLayout(new BorderLayout(1, 1)); table = new GroupEditTable(); dialogPanel.add(new WarningScrollTable(table, WARNING_CLASS)); add(dialogPanel, BorderLayout.CENTER); }
private final void initialize() { SpringLayout l = new SpringLayout(); this.setLayout(l); this.setPreferredSize(D); this.setMinimumSize(D); Category[] v = Category.values(); AnimPanel[] catPanels = new AnimPanel[v.length]; for (int i = 0; i < v.length; i++) { catPanels[i] = new AnimPanel(v[i], doThing); } PrettyBox<AnimPanel> catList = new PrettyBox<AnimPanel>(catPanels); JPanel listWrap = new JPanel(); JScrollPane wrap = new JScrollPane(listWrap); JPanel w = (JPanel) this.getContentPane(); l.putConstraint(NORTH, catList, 5, NORTH, w); l.putConstraint(EAST, catList, -5, EAST, w); l.putConstraint(WEST, catList, 5, WEST, w); w.add(catList); l.putConstraint(NORTH, wrap, 5, SOUTH, catList); l.putConstraint(SOUTH, wrap, -5, SOUTH, w); l.putConstraint(EAST, wrap, 0, EAST, catList); l.putConstraint(WEST, wrap, 0, WEST, catList); w.add(wrap); catList.addItemListener( arg0 -> { listWrap.removeAll(); listWrap.add((AnimPanel) catList.getSelectedItem()); this.revalidate(); this.repaint(); }); listWrap.add(catPanels[0]); }
public TemplateListEditor(GrammarModel grammar) { super(grammar, new SpringLayout()); extractFromTemplates(); addHeaderText(); addListPanel(); addInfoPanel(); SpringUtilities.makeCompactGrid(this, 3, 1, 0, 0, 0, 3); refresh(); }
/** * Create a bug reporting dialog. * @param e the exception that caused the bug. */ public BugReportDialog(Throwable e) { super((JFrame) null, DIALOG_TITLE, true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setResizable(false); // Create the content panel, which is laid out as a single column. // Add an empty space of 10 pixels between the dialog and the content // panel. JPanel dialogContent = new JPanel(new SpringLayout()); dialogContent.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Make sure that closeDialog is called whenever the dialog is closed. addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { closeDialog(); } }); // Fill the dialog. dialogContent.add(this.getErrorMessage()); dialogContent.add(this.getStackTracePane(e)); dialogContent.add(this.getButtonPanel()); // Put the panels in a CompactGrid layout. SpringUtilities.makeCompactGrid(dialogContent, 3, 1, 0, 0, 0, 0); // Add the dialogContent to the dialog. add(dialogContent); pack(); setVisible(true); }
/** Creates the dialog. */ public ExplorationStatsDialog(Simulator simulator, JFrame parent) { super(parent, DIALOG_TITLE, true); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); setResizable(false); this.simulator = simulator; // Create the content panel, which is laid out as a single column. // Add an empty space of 10 pixels between the dialog and the content // panel. JPanel dialogContent = new JPanel(new SpringLayout()); dialogContent.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Make sure that closeDialog is called whenever the dialog is closed. addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent we) { closeDialog(); } }); // Fill the dialog. dialogContent.add(this.getInfoPane()); dialogContent.add(this.getButtonPanel()); // Put the panels in a CompactGrid layout. SpringUtilities.makeCompactGrid(dialogContent, 2, 1, 0, 0, 0, 0); // Add the dialogContent to the dialog. add(dialogContent); pack(); setLocationRelativeTo(parent); setVisible(true); }
/** * Setups GlassPane with lightweight component returned by {@link SimpleOverlappingTestBase#getSwingComponent() } * Called by base class. */ @Override protected void prepareControls() { wasLWClicked = false; if(f != null) { f.setVisible(false); } f = new JFrame("Mixing : GlassPane Overlapping test"); f.setLayout(new SpringLayout()); f.setSize(200, 200); propagateAWTControls(f); f.getGlassPane().setVisible(true); Container glassPane = (Container) f.getGlassPane(); glassPane.setLayout(null); testedComponent = getSwingComponent(); if (useDefaultClickValidation) { testedComponent.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { //System.err.println("lw mouse clicked"); wasLWClicked = true; } }); } testedComponent.setBounds(0, 0, testedComponent.getPreferredSize().width, testedComponent.getPreferredSize().height); glassPane.add(testedComponent); f.setVisible(true); }