private JPanel createDynamicCenterPanel(PrimitiveForm primitiveForm, DOTProperty property) { final JTable theTable = new JTable(); PrimitiveFormPropertyPair pfpPair = new PrimitiveFormPropertyPair(primitiveForm.getName(), property); _dynamicTables.put(pfpPair, theTable); DOTPoint dotPoint = (DOTPoint) _dotDefinitionDialogFrame.getScratchDisplayObjectType(); final DynamicDOTItemManager tableModel = (DynamicDOTItemManager) dotPoint.getTableModel(primitiveForm, property); theTable.setModel(tableModel); class NumberComparator implements Comparator<Number> { public int compare(Number o1, Number o2) { final double d1 = o1.doubleValue(); final double d2 = o2.doubleValue(); if (d1 < d2) { return -1; } if (d1 == d2) { return 0; } return 1; } } TableRowSorter<DynamicDOTItemManager> tableRowSorter = new TableRowSorter<DynamicDOTItemManager>(); tableRowSorter.setModel(tableModel); tableRowSorter.setComparator(4, new NumberComparator()); tableRowSorter.setComparator(5, new NumberComparator()); theTable.setRowSorter(tableRowSorter); JButton newDOTItemButton = new JButton("Neue Zeile"); newDOTItemButton.setEnabled(_dotDefinitionDialogFrame.isEditable()); JButton deleteDOTItemButton = new JButton("Zeile löschen"); deleteDOTItemButton.setEnabled(false); JButton showConflictsButton = new JButton("Zeige Konflikte"); addButtonListeners( primitiveForm, property, newDOTItemButton, deleteDOTItemButton, showConflictsButton); addListSelectionListener(theTable, deleteDOTItemButton); JPanel dotButtonsPanel = new JPanel(); dotButtonsPanel.setLayout(new SpringLayout()); dotButtonsPanel.add(newDOTItemButton); dotButtonsPanel.add(deleteDOTItemButton); dotButtonsPanel.add(showConflictsButton); dotButtonsPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10)); SpringUtilities.makeCompactGrid(dotButtonsPanel, 1, 5, 20); JPanel thePanel = new JPanel(); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(new JScrollPane(theTable)); thePanel.add(dotButtonsPanel); SpringUtilities.makeCompactGrid(thePanel, 2, 20, 5); return thePanel; }
protected void setButtonBorder() { if (Utilities.isLeftToRight(comboBox)) { Border border = BorderFactory.createMatteBorder(0, 1, 0, 0, BaseLookAndFeel.getFrameColor()); arrowButton.setBorder(border); } else { Border border = BorderFactory.createMatteBorder(0, 0, 0, 1, BaseLookAndFeel.getFrameColor()); arrowButton.setBorder(border); } }
private void initMyComponents() { orderLabel.setFont(new Font("fans serif", Font.BOLD, 14)); orderLabel.setText("" + order.getOrderNumber()); dateLabel.setFont(new Font("Georgia", Font.PLAIN, 14)); dateLabel.setText("" + order.getDate()); orderPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, typBrun)); datePanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, typBrun)); }
public JButton createArrowButton() { JButton button = new ArrowButton(); if (Utilities.isLeftToRight(comboBox)) { Border border = BorderFactory.createMatteBorder(0, 1, 0, 0, BaseLookAndFeel.getFrameColor()); button.setBorder(border); } else { Border border = BorderFactory.createMatteBorder(0, 0, 0, 1, BaseLookAndFeel.getFrameColor()); button.setBorder(border); } return button; }
public ViewHolder(String id, String loc, JSplitPane sp) { this.loc = loc; this.splitPane = sp; setLayout(new BorderLayout()); // setMinimumSize(new Dimension(5, 5)); addContainerListener( new ContainerListener() { public void componentAdded(ContainerEvent e) { if (getComponentCount() == 1) { splitPane.add(ViewHolder.this, ViewHolder.this.loc); } } public void componentRemoved(ContainerEvent e) { if (getComponentCount() == 0) { splitPane.remove(ViewHolder.this); } } }); createHolder(); setBorder( BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(1, 1, 1, 1, Color.LIGHT_GRAY), BorderFactory.createEmptyBorder(2, 2, 2, 2))); }
public ConverterPanel(CFrame F, ConvertibleValue CV) { super(new GridBagLayout()); // call to super must be first statement in constructor setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.blue)); frame = F; cValue = CV; preferedSize = new Dimension(100, 40); setBackground(white); } // constructor
/** Creates new form ProductPanel */ public OrderPanel(Order o) { order = o; initComponents(); initMyComponents(); this.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, typBrun)); this.repaint(); this.revalidate(); }
/** * Indent the label of a field with a MatteBorder having the width of a JCheckBox and the color of * the component background. This helps to align JCheckBox label (text on the right of the * CheckBox) with other component labels (text on the left of the component). * * @param fieldName the field to indent */ public void indentLabel(String fieldName) { getLabel(fieldName) .setBorder( BorderFactory.createMatteBorder( 0, (int) new JCheckBox().getPreferredSize().getWidth(), 0, 0, getLabel(fieldName).getBackground())); }
/** * Enables/disables left border {@link #BORDER_SIZE_PX} width for certain editors. * * @param editors editors to enable/disable border * @param enable whether border should be enabled */ private static void configureLeftBorder( final boolean enable, @NotNull final EditorEx... editors) { for (final EditorEx editor : editors) { final Color backgroundColor = editor.getBackgroundColor(); // Border have the same color console background has final int thickness = enable ? BORDER_SIZE_PX : 0; final Border border = BorderFactory.createMatteBorder(0, thickness, 0, 0, backgroundColor); editor.getComponent().setBorder(border); } }
public void initializeUI() throws Exception { // initialize components btnPrev.setActionCommand("PREVIOUS"); btnPrev.setFont(new Font("dialog", Font.PLAIN, 10)); btnNext.setActionCommand("NEXT"); btnNext.setFont(new Font("dialog", Font.PLAIN, 10)); btnPrev.setEnabled(false); btnPrev.addActionListener(this); btnNext.addActionListener(this); jtaMsgTarget.setEditable(false); setLayout(new BorderLayout()); JPanel pnlAll = new JPanel(new BorderLayout()); ImageIcon imgIcon = new ImageIcon(); pnlContent.add(pnlDStarget, "OPEN_DS_TARGET"); pnlShowConnectTarget.add(jtaMsgTarget, BorderLayout.CENTER); pnlContent.add(pnlShowConnectTarget, "DS_TARGET_MSG"); rlp = new RestoreLoaderPanel(); pnlContent.add(rlp, "DB_OPEN_FILE"); JPanel pnlButtons = new JPanel(); pnlButtons.add(btnPrev); pnlButtons.add(btnNext); pnlButtons.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, pnlButtons.getForeground())); jlblTitle.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, jlblTitle.getForeground())); // add title no NORTH pnlAll.add(jlblTitle, BorderLayout.NORTH); pnlAll.add(pnlContent, BorderLayout.CENTER); pnlAll.add(new JLabel(imgIcon), BorderLayout.WEST); pnlAll.add(pnlButtons, BorderLayout.SOUTH); add(pnlAll, BorderLayout.CENTER); pnlAll.setPreferredSize(new Dimension(500, 300)); pnlAll.setMinimumSize(new Dimension(500, 300)); }
/** * Creates the contactlist scroll panel defining the parent frame. * * @param mainFrame The parent frame. */ public ContactListPane(MainFrame mainFrame) { this.mainFrame = mainFrame; this.chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); this.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); this.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.GRAY)); this.initPluginComponents(); }
// int jlabel3_state=0; public void mouseClicked(MouseEvent e) { JLabel source = (JLabel) e.getSource(); if (label_state.get(source) == 0) { if (source.getName() == "jLabel11") { if (challenge_file == null) { JOptionPane.showMessageDialog(null, "Challenge File Not Loaded"); } else { reset_labelState(); active_label = (JLabel) source; label_state.put(source, 1); try { ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("resources/images/pause.jpg")); jLabel11.setIcon(icon); } catch (Exception et) { JOptionPane.showMessageDialog(null, et.toString()); } } } else { reset_labelState(); active_label = (JLabel) source; label_state.put(source, 1); } source.setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, Color.BLUE)); } else { active_label = null; label_state.put(source, 0); if (source.getName() == "jLabel11") { try { ImageIcon icon = new javax.swing.ImageIcon(getClass().getResource("resources/images/play.jpg")); jLabel11.setIcon(icon); } catch (Exception et) { JOptionPane.showMessageDialog(null, et.toString()); } } source.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE)); } }
public static void main(String[] args) { // create a JFrame to hold everything JFrame frame = new JFrame("Borders"); // Create labels with borders. int center = SwingConstants.CENTER; JLabel labelOne = new JLabel("raised BevelBorder", center); labelOne.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); JLabel labelTwo = new JLabel("EtchedBorder", center); labelTwo.setBorder(BorderFactory.createEtchedBorder()); JLabel labelThree = new JLabel("MatteBorder", center); labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink)); JLabel labelFour = new JLabel("TitledBorder", center); Border etch = BorderFactory.createEtchedBorder(); labelFour.setBorder(BorderFactory.createTitledBorder(etch, "Title")); JLabel labelFive = new JLabel("TitledBorder", center); Border low = BorderFactory.createLoweredBevelBorder(); labelFive.setBorder( BorderFactory.createTitledBorder(low, "Title", TitledBorder.RIGHT, TitledBorder.BOTTOM)); JLabel labelSix = new JLabel("CompoundBorder", center); Border one = BorderFactory.createEtchedBorder(); Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue); labelSix.setBorder(BorderFactory.createCompoundBorder(one, two)); // add components to the content pane Container c = frame.getContentPane(); // unecessary in 1.5+ c.setLayout(new GridLayout(3, 2)); c.add(labelOne); c.add(labelTwo); c.add(labelThree); c.add(labelFour); c.add(labelFive); c.add(labelSix); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
private static void insertQuestion(final JTextPane textPane, String str) { Document doc = textPane.getDocument(); try { doc.insertString(doc.getLength(), str, null); final int pos = doc.getLength(); System.out.println(pos); final JTextField field = new JTextField(4) { @Override public Dimension getMaximumSize() { return getPreferredSize(); } }; field.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK)); field.addFocusListener( new FocusListener() { @Override public void focusGained(FocusEvent e) { try { Rectangle rect = textPane.modelToView(pos); rect.grow(0, 4); rect.setSize(field.getSize()); // System.out.println(rect); // System.out.println(field.getLocation()); textPane.scrollRectToVisible(rect); } catch (BadLocationException ex) { ex.printStackTrace(); } } @Override public void focusLost(FocusEvent e) { /* not needed */ } }); Dimension d = field.getPreferredSize(); int baseline = field.getBaseline(d.width, d.height); field.setAlignmentY(baseline / (float) d.height); SimpleAttributeSet a = new SimpleAttributeSet(); StyleConstants.setLineSpacing(a, 1.5f); textPane.setParagraphAttributes(a, true); textPane.insertComponent(field); doc.insertString(doc.getLength(), "\n", null); } catch (BadLocationException e) { e.printStackTrace(); } }
@Override public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel titleLabel = new JLabel(value.toString()); titleLabel.setBorder(new EmptyBorder(5, 5, 5, 0)); titleLabel.setFont(UIConfiguration.getInstance().getDefaultFont(true)); titleLabel.setForeground(new Color(30, 30, 30)); titleLabel.setBackground(new Color(0, 0, 0)); panel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 1, new Color(156, 156, 156))); panel.setBackground(new Color(205, 205, 205)); panel.add(titleLabel); return panel; }
private JPanel createButtonPanel() { JPanel b = new JPanel(); loadButton = new JButton("Load Feedback"); saveButton = new JButton("Save Feedback"); downloadButton = new JButton("Download Feedback"); b.add(loadButton); b.add(saveButton); b.add(downloadButton); b.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY)); return b; }
private NewPanel() { setBackground(Color.decode(ColorManager.getCreatePanelBackground())); Dimension dim = new Dimension(200, 120); setPreferredSize(dim); JTextField text = new JTextField("", 15); SubmitButton submit = new SubmitButton(text); setBorder( BorderFactory.createMatteBorder( 5, 5, 5, 5, Color.decode(ColorManager.getCreatePanelBorder()))); JLabel label = new JLabel("Create a new button"); label.setForeground(Color.decode(ColorManager.getCreatePanelText())); add(label); add(text); add(submit); }
/** * Create a component that will replace the spinner models value with the object returned by * <code>spinner.getNextValue</code>. By default the <code>nextButton</code> is a JButton who's * <code>ActionListener</code> updates it's <code>JSpinner</code> ancestors model. If a nextButton * isn't needed (in a subclass) then override this method to return null. * * @return a component that will replace the spinners model with the next value in the sequence, * or null * @see #installUI * @see #createPreviousButton */ protected Component createNextButton() { Component tmpButton = super.createNextButton(); if (tmpButton instanceof JButton) { JButton result = new ArrowButton(SwingConstants.NORTH); ((ArrowButton) result).setDrawBottomBorder(false); result.setBorder( BorderFactory.createMatteBorder(1, 1, 0, 1, UIManager.getColor("Button.borderColor"))); ActionListener al[] = ((JButton) tmpButton).getActionListeners(); for (int i = 0; i < al.length; i++) result.addActionListener(al[i]); MouseListener ml[] = ((JButton) tmpButton).getMouseListeners(); for (int i = 0; i < ml.length; i++) result.addMouseListener(ml[i]); return result; } else return tmpButton; }
public ContactFileEditor(GemDesktop _desktop) { super(_desktop); note = new GemLabel(); note.setForeground(java.awt.Color.red); personView = new PersonView(); infosView = new GemPanel(); infosView.setBorder(BorderFactory.createMatteBorder(0, 1, 0, 0, Color.lightGray)); teleView = new TelView( ParamTableIO.find(Category.TELEPHONE.getTable(), Category.TELEPHONE.getCol(), dc)); emailView = new EmailView(); websiteView = new WebSiteView( ParamTableIO.find(Category.SITEWEB.getTable(), Category.SITEWEB.getCol(), dc)); infosView.setLayout(new BoxLayout(infosView, BoxLayout.Y_AXIS)); infosView.add(teleView); infosView.add(emailView); infosView.add(websiteView); JScrollPane scp = new JScrollPane(infosView); scp.setBorder(null); scp.setPreferredSize(new Dimension(400, scp.getPreferredSize().height)); GemPanel addressPanel = new GemPanel(); addressPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); addressView = new AddressView(); addressView.setBorder(null); addressPanel.add(addressView, BorderLayout.SOUTH); this.setLayout(new GridBagLayout()); gb = new GridBagHelper(this); GemBorderPanel gp = new GemBorderPanel(new BorderLayout()); gp.add(personView, BorderLayout.WEST); gp.add(scp, BorderLayout.EAST); gb.add(gp, 0, 0, 1, 1, GridBagHelper.BOTH, 1.0, 1.0); gb.add(addressPanel, 0, 2, 1, 1, GridBagHelper.BOTH, GridBagHelper.WEST); gb.add(note, 0, 3, 1, 1, GridBagHelper.HORIZONTAL, GridBagHelper.WEST); }
public JComponent getController(final TresCanvas canvas) { JPanel panel = new JPanel(new FlowLayout(FlowLayout.CENTER, 1, 0)); Color color = m_algo.getColor(); panel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, color)); panel.setBackground(color); JCheckBox checkBox = new JCheckBox(m_algo.m_name, m_doPaint) { @Override protected void fireItemStateChanged(ItemEvent event) { super.fireItemStateChanged(event); m_doPaint = (event.getStateChange() == ItemEvent.SELECTED); canvas.repaint(); } }; checkBox.setOpaque(false); panel.add(checkBox); panel.add(m_algo.getController(canvas)); return panel; }
public ProblemPresetsPanel() { NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(4); problemSizeEdit = createIntValueEdit(); stockLengthEdit = createIntValueEdit(); orderLengthLowerBoundEdit = createFloatValueEdit(nf); orderLengthUpperBoundEdit = createFloatValueEdit(nf); averageDemandEdit = createIntValueEdit(); setLayout(new GridBagLayout()); add( new JLabel("Problem descriptors"), new GBC(0, 0, 2, 1).setFill(GBC.BOTH).setWeight(100, 0).setInsets(10, 10, 10, 10)); add( new JLabel("size:", SwingConstants.RIGHT), new GBC(0, 1).setFill(GBC.BOTH).setWeight(100, 0).setInsets(5, 10, 3, 5)); add(problemSizeEdit, new GBC(1, 1).setInsets(5, 0, 3, 10)); add( new JLabel("stock length:", SwingConstants.RIGHT), new GBC(0, 2).setFill(GBC.BOTH).setWeight(100, 0).setInsets(3, 10, 3, 5)); add(stockLengthEdit, new GBC(1, 2).setInsets(3, 0, 3, 10)); add( new JLabel("order length LB:", SwingConstants.RIGHT), new GBC(0, 3).setFill(GBC.BOTH).setWeight(100, 0).setInsets(3, 10, 3, 5)); add(orderLengthLowerBoundEdit, new GBC(1, 3).setInsets(3, 0, 3, 10)); add( new JLabel("order length UB:", SwingConstants.RIGHT), new GBC(0, 4).setFill(GBC.BOTH).setWeight(100, 0).setInsets(3, 10, 3, 5)); add(orderLengthUpperBoundEdit, new GBC(1, 4).setInsets(3, 0, 3, 10)); add( new JLabel("average demand:", SwingConstants.RIGHT), new GBC(0, 5).setFill(GBC.BOTH).setWeight(100, 0).setInsets(3, 10, 10, 5)); add(averageDemandEdit, new GBC(1, 5).setInsets(3, 0, 10, 10)); setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.GRAY)); }
public void setGoal(File file) throws FileNotFoundException, IOException { FileInputStream fstream = new FileInputStream(file); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; // Read File Line By Line strLine = br.readLine(); input_count = Integer.valueOf(br.readLine()); results = new String[input_count]; tapes = new String[input_count]; for (int i = 0; i < input_count; i++) { results[i] = br.readLine(); tapes[i] = br.readLine(); } jLabel1.setText(strLine); jLabel1.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.BLACK)); br.close(); }
private StaticPanel createStaticComboBoxPanel( PrimitiveForm primitiveForm, DOTProperty property, String labelText, Object[] items) { JLabel label = new JLabel(labelText); JComboBox comboBox = new JComboBox(items); comboBox.setMaximumSize(new Dimension(300, 25)); comboBox.setEnabled(_dotDefinitionDialogFrame.isEditable()); StaticPanel thePanel = new StaticPanel(primitiveForm, property); thePanel.setMaximumSize(new Dimension(300, 25)); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(label); thePanel.add(comboBox); SpringUtilities.makeCompactGrid(thePanel, 2, 5, 5); thePanel.setValue(comboBox); thePanel.addListener(comboBox); return thePanel; }
BoggleBoardPanel(int rows, int cols) { this.rows = rows; this.cols = cols; // create a JPanel with rowsXcols GridLayout to hold the DiePanels JPanel innerPanel = new JPanel(); innerPanel.setLayout(new GridLayout(rows, cols, 1, 1)); innerPanel.setBackground(BACKGROUNDCOLOR); // Create Individual DiePanels, and add them theDice = new DiePanel[rows][cols]; for (int row = 0; row < rows; row++) { for (int col = 0; col < cols; col++) { theDice[row][col] = new DiePanel(); innerPanel.add(theDice[row][col]); } } innerPanel.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, BACKGROUNDCOLOR)); this.add(innerPanel); }
private StaticPanel createStaticSpinnerPanel( PrimitiveForm primitiveForm, DOTProperty property, String labelText, SpinnerModel spinnerModel) { JLabel label = new JLabel(labelText); JSpinner spinner = new JSpinner(spinnerModel); spinner.setMaximumSize(new Dimension(200, 20)); spinner.setEnabled(_dotDefinitionDialogFrame.isEditable()); StaticPanel thePanel = new StaticPanel(primitiveForm, property); thePanel.setLayout(new SpringLayout()); thePanel.setBorder(BorderFactory.createMatteBorder(2, 2, 2, 2, Color.BLACK)); thePanel.add(label); thePanel.add(spinner); SpringUtilities.makeCompactGrid(thePanel, 2, 5, 5); thePanel.setValue(spinner); thePanel.addListener(spinner); return thePanel; }
public FigTreePanel( JFrame frame, final ExtendedTreeViewer treeViewer, ControlPalette controlPalette) { this.treeViewer = treeViewer; this.controlPalette = controlPalette; // the scrollpane below now has this border // controlPalette.getPanel().setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, // Color.GRAY)); controlPalette.getPanel().setBackground(new Color(231, 237, 246)); controlPalette.getPanel().setOpaque(true); treeViewerController = new TreeViewerController(treeViewer); controlPalette.addController(treeViewerController); controlPalette.addController(new MultipleTreesController(treeViewer)); // This controller handles reading/writing of attribute colour schemes but doesn't presently // show any UI AttributeColourController attributeColourController = new AttributeColourController(treeViewer, frame); controlPalette.addController(attributeColourController); controlPalette.addController( new TreeAppearanceController(treeViewer, frame, attributeColourController)); treesController = new TreesController(treeViewer); controlPalette.addController(treesController); controlPalette.addController(new TimeScaleController(treeViewer)); // Create a tip label painter and its controller final BasicLabelPainter tipLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.TIP); controlPalette.addController( new LabelPainterController( "Tip Labels", "tipLabels", tipLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setTipLabelPainter(tipLabelPainter); // Create a node label painter and its controller final BasicLabelPainter nodeLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.NODE); nodeLabelPainter.setVisible(false); controlPalette.addController( new LabelPainterController( "Node Labels", "nodeLabels", nodeLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setNodeLabelPainter(nodeLabelPainter); // Create a node bar painter and its controller final NodeBarPainter nodeBarPainter = new NodeBarPainter(); nodeBarPainter.setForeground(new Color(24, 32, 228, 128)); nodeBarPainter.setVisible(false); controlPalette.addController(new NodeBarController("Node Bars", nodeBarPainter, treeViewer)); treeViewer.setNodeBarPainter(nodeBarPainter); // Create a node shape painter and its controller final NodeShapePainter nodeShapePainter = new NodeShapePainter(); nodeShapePainter.setVisible(false); controlPalette.addController( new NodeShapeController( "Node Shapes", nodeShapePainter, attributeColourController, treeViewer)); treeViewer.setNodeShapePainter(nodeShapePainter); // Create a branch label painter and its controller final BasicLabelPainter branchLabelPainter = new BasicLabelPainter(BasicLabelPainter.PainterIntent.BRANCH); branchLabelPainter.setVisible(false); controlPalette.addController( new LabelPainterController( "Branch Labels", "branchLabels", branchLabelPainter, frame, attributeColourController, treeViewer)); treeViewer.setBranchLabelPainter(branchLabelPainter); // Create a scale controller final ScaleBarPainter scaleBarPainter = new ScaleBarPainter(); scaleBarPainter.setVisible(true); controlPalette.addController(new ScaleBarPainterController(scaleBarPainter, treeViewer)); treeViewer.addScalePainter(scaleBarPainter); // Create a scale axis controller final ScaleAxisPainter scaleAxisPainter = new ScaleAxisPainter(); final ScaleGridPainter scaleGridPainter = new ScaleGridPainter(); scaleAxisPainter.setVisible(false); scaleGridPainter.setVisible(false); controlPalette.addController( new ScaleAxisPainterController(scaleAxisPainter, scaleGridPainter, treeViewer)); treeViewer.addScalePainter(scaleAxisPainter); treeViewer.setScaleGridPainter(scaleGridPainter); // Create a legend controller final LegendPainter legendPainter = new LegendPainter(attributeColourController); legendPainter.setVisible(false); controlPalette.addController( new LegendPainterController(legendPainter, attributeColourController, treeViewer)); treeViewer.setLegendPainter(legendPainter); slideOpenPanel = new SlideOpenPanel(treeViewer); setLayout(new BorderLayout()); // add(slideOpenPanel, BorderLayout.CENTER); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, Color.GRAY)); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); int scrollBarWidth = scrollPane.getVerticalScrollBar().getWidth(); int controlPanelWidth = CONTROL_PALETTE_WIDTH + scrollBarWidth; controlPalette.setPreferredWidth(controlPanelWidth); scrollPane.setViewportView(controlPalette.getPanel()); // add(scrollPane, BorderLayout.WEST); JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPane, slideOpenPanel); splitPane.putClientProperty("Quaqua.SplitPane.style", "bar"); splitPane.setOneTouchExpandable(true); add(splitPane, BorderLayout.CENTER); int w = splitPane.getLeftComponent().getPreferredSize().width; splitPane.getLeftComponent().setMinimumSize(new Dimension(w, 0)); // splitPane.getLeftComponent().setMaximumSize(new Dimension(2 * w, 0)); // Might be possible to improve the action of the oneTouchExpandable button. Ideally would not // allow // maximization of control panel, only its collapse. // BasicSplitPaneDivider bspd = ((BasicSplitPaneUI)splitPane.getUI()).getDivider(); // try { // Field rightButtonField = // BasicSplitPaneDivider.class.getDeclaredField("rightButton"); // rightButtonField.setAccessible(true); // JButton rightButton = (JButton) // rightButtonField.get(((BasicSplitPaneUI)splitPane.getUI()).getDivider()); // // Field leftButtonField = // BasicSplitPaneDivider.class.getDeclaredField("leftButton"); // leftButtonField.setAccessible(true); // JButton leftButton = (JButton) // leftButtonField.get(((BasicSplitPaneUI)splitPane.getUI()).getDivider()); // // // } catch (Exception e) { // e.printStackTrace(); // } // treeViewer.addAnnotationsListener(new AnnotationsListener() { // public void annotationsChanged() { // // tipLabelPainter.setupAttributes(treeViewer.getTrees()); // nodeLabelPainter.setupAttributes(treeViewer.getTrees()); // nodeBarPainter.setupAttributes(treeViewer.getTrees()); // branchLabelPainter.setupAttributes(treeViewer.getTrees()); // legendPainter.setupAttributes(treeViewer.getTrees()); // } // }); }
// swing gui / constructor public Main(final Field f) { super("Sudoku Solver"); URL iconURL = getClass().getResource("icon.png"); ImageIcon img = new ImageIcon(iconURL); jFrame.setIconImage(img.getImage()); Color darkBlue = new Color(51, 102, 153); Color lightBlue = new Color(18, 61, 104); grid = new JTextField[9][9]; jGrid.setLayout(new GridLayout(9, 9)); jGrid.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, darkBlue)); jGrid.setBackground(darkBlue); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { grid[i][j] = new JTextField(); grid[i][j].setDocument(new JTextFieldLimit(1)); grid[i][j].setFont(new Font("Arial", Font.PLAIN, 20)); grid[i][j].setHorizontalAlignment(JTextField.CENTER); grid[i][j].setText(""); grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, lightBlue)); if (j == 2 || j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 5, lightBlue)); } if (i == 2 || i == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 1, lightBlue)); } if (i == 2 && j == 2) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 5 && j == 2) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 2 && j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 5 && j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } jGrid.add(grid[i][j]); } } jButton.setLayout(new FlowLayout()); jButton.setBackground(darkBlue); jButton.setPreferredSize(new Dimension(420, 45)); jButton.add(solve); solve.setLabel("Solve"); solve.setVisible(true); solve.setFont(new Font("HelveticaNeue", Font.PLAIN, 20)); solve.setForeground(Color.BLACK); jButton.add(upload); upload.setLabel("Upload"); upload.setVisible(true); upload.setFont(new Font("Arial", Font.PLAIN, 20)); upload.setForeground(Color.BLACK); jButton.add(clear); clear.setLabel("Clear"); clear.setVisible(true); clear.setFont(new Font("Arial", Font.PLAIN, 20)); clear.setForeground(Color.BLACK); jGrid.setPreferredSize(new Dimension(400, 400)); jFrame.setResizable(false); jFrame.setVisible(true); jFrame.setLocationRelativeTo(null); jFrame.setSize(420, 480); jFrame.setBackground(darkBlue); jFrame.add(jGrid, BorderLayout.PAGE_START); jFrame.add(jButton, BorderLayout.PAGE_END); ActionListener solvedClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); gridToModel(f); if (!errorFound(f)) { runSolve(f); makeGrid(f, false); solve.setEnabled(false); } } }; ActionListener uploadClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); f.clearModel(); makeGrid(f, true); solve.setEnabled(true); f.fromFile(); makeGrid(f, true); } }; ActionListener clearClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); f.clearModel(); makeGrid(f, true); solve.setEnabled(true); } }; solve.addActionListener(solvedClicked); upload.addActionListener(uploadClicked); clear.addActionListener(clearClicked); }
public GUI() { // Sets the text and initiates the objects for the buttons playButton = new JButton("PLAY"); exitButton = new JButton("QUIT"); howToPlay = new JButton("HOW TO PLAY"); quitEducation = new JButton("Quit education"); rollDice = new JButton("ROLL THE DICE"); saveCareerProspects = new JButton("Save career prospects"); exitApplication = new JButton("Exit application"); // The main container for the JFrames // container for frame JPanel welcome = new JPanel(); spalshScreen.setContentPane(welcome); JPanel container = new JPanel(); frame.setContentPane(container); // container for frame 2 JPanel container2 = new JPanel(); container2.setBackground(Color.WHITE); frame2.setContentPane(container2); // container for frame 3 JPanel container3 = new JPanel(); container3.setBackground(Color.WHITE); frame3.setContentPane(container3); loading = new javax.swing.JLabel(); loading.setIcon( new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/hexLoader.gif"))); // start panel with play button and exit button // for frame playerName = new javax.swing.JTextField(); playerName.setText("Player"); playerName.setLocation(100, 100); playerName.setPreferredSize(new Dimension(100, 100)); playerName.setHorizontalAlignment(JTextField.CENTER); JPanel frame = new JPanel(); frame.add(playerName); frame.add(playButton); playButton.setPreferredSize(new Dimension(200, 100)); frame.add(exitButton); exitButton.setPreferredSize(new Dimension(200, 100)); frame.add(howToPlay); howToPlay.setPreferredSize(new Dimension(200, 100)); // board image start screen start = new javax.swing.JLabel(); start.setIcon( new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/logo2.png"))); // for frame 2 JPanel frame2 = new JPanel(); frame2.add(quitEducation); /* Start of creating the board */ JButton ordinaryButton; int row = 10, column = 10; frame2.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(3, 3, 3, 3); for (int j = 1; j <= row; j++) { for (int i = 0; i < column; i++) { ordinaryButton = new JButton(); if (i == column - 1 && j == row) doActiveTile(ordinaryButton); if (j == 1) { // top line gbc.ipady = 30; gbc.gridx = i; gbc.gridy = j; gbc.gridwidth = 1; addToList(ordinaryButton, TOP); frame2.add(ordinaryButton, gbc); // add in the frame } else { if (j == 10) { // bottom line gbc.ipady = 30; gbc.gridx = i; gbc.gridy = j; gbc.gridwidth = 1; addToList(ordinaryButton, BOTTOM); frame2.add(ordinaryButton, gbc); // add in the frame } else { if (i == 0) { // left-hand side column gbc.ipady = 30; gbc.gridx = i; gbc.gridy = j; gbc.gridwidth = 1; addToList(ordinaryButton, LEFT); frame2.add(ordinaryButton, gbc); // add in the frame } else { if (i == 9) { // right-hand side column gbc.ipady = 30; gbc.gridx = i; gbc.gridy = j; gbc.gridwidth = 1; addToList(ordinaryButton, RIGHT); frame2.add(ordinaryButton, gbc); // add in the frame } } } } } } /* End of creating the board */ /* adding constraints for roll dice and Quit education */ gbc.ipady = 30; gbc.gridx = 2; gbc.gridy = 4; gbc.gridwidth = 2; frame2.add(rollDice, gbc); // add in the frame gbc.ipady = 30; gbc.gridx = 6; gbc.gridy = 4; gbc.gridwidth = 2; frame2.add(quitEducation, gbc); // add in the frame /* END OF adding constraints for roll dice and Quit education */ // for frame 3 JPanel frame3 = new JPanel(); frame3.setLayout(new GridBagLayout()); gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.insets = new Insets(3, 3, 3, 3); gbc.ipady = 30; gbc.gridx = 1; gbc.gridy = 1; gbc.gridwidth = 4; frame3.add(saveCareerProspects, gbc); frame3.setBackground(Color.WHITE); skillsLabel = new javax.swing.JLabel("SKILLS"); skillsLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.ORANGE)); Font font = skillsLabel.getFont(); // same font but bold int fontSize = font.getSize(); fontSize += 5; Font boldFont = new Font(font.getFontName(), Font.BOLD, fontSize); skillsLabel.setFont(boldFont); gbc.ipady = 10; gbc.gridx = 1; gbc.gridy = 3; gbc.gridwidth = 1; frame3.add(skillsLabel, gbc); mathematicsLabel = new javax.swing.JLabel(); mathematicsLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.PINK)); gbc.gridx = 1; gbc.gridy = 4; gbc.gridwidth = 1; frame3.add(mathematicsLabel, gbc); scienceLabel = new javax.swing.JLabel(); scienceLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.CYAN)); gbc.gridx = 1; gbc.gridy = 5; gbc.gridwidth = 1; frame3.add(scienceLabel, gbc); computerScienceLabel = new javax.swing.JLabel(); computerScienceLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.green)); gbc.gridx = 1; gbc.gridy = 6; gbc.gridwidth = 1; frame3.add(computerScienceLabel, gbc); geographyLabel = new javax.swing.JLabel(); geographyLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.RED)); gbc.gridx = 1; gbc.gridy = 7; gbc.gridwidth = 1; frame3.add(geographyLabel, gbc); historyLabel = new javax.swing.JLabel(); historyLabel.setBorder(BorderFactory.createMatteBorder(1, 5, 1, 1, Color.BLACK)); gbc.gridx = 1; gbc.gridy = 8; gbc.gridwidth = 1; frame3.add(historyLabel, gbc); gbc.ipady = 30; gbc.gridx = 1; gbc.gridy = 9; gbc.gridwidth = 4; frame3.add(exitApplication, gbc); gbc.ipady = 10; careersLabel = new javax.swing.JLabel("CAREER PROSPECTS", SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 3; gbc.gridwidth = 1; careersLabel.setFont(boldFont); frame3.add(careersLabel, gbc); secondColMaths = new javax.swing.JLabel(mathematicsCareer[0], SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 4; gbc.gridwidth = 1; frame3.add(secondColMaths, gbc); secondColScience = new javax.swing.JLabel(scienceCareer[0], SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 5; gbc.gridwidth = 1; frame3.add(secondColScience, gbc); secondColCompScience = new javax.swing.JLabel(computerScienceCareer[0], SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 6; gbc.gridwidth = 1; frame3.add(secondColCompScience, gbc); secondColGeography = new javax.swing.JLabel(geographyCareer[0], SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 7; gbc.gridwidth = 1; frame3.add(secondColGeography, gbc); secondColHistory = new javax.swing.JLabel(historyCareer[0], SwingConstants.RIGHT); gbc.gridx = 3; gbc.gridy = 8; gbc.gridwidth = 1; frame3.add(secondColHistory, gbc); JLabel skills = new javax.swing.JLabel(); skills.setIcon( new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/small.jpg"))); gbc.gridx = 1; gbc.gridy = 1; gbc.gridheight = 9; gbc.gridwidth = 3; frame3.add(skills, gbc); JLabel backgroundImage = new javax.swing.JLabel(); backgroundImage.setIcon( new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/logoSmall.jpg"))); gbc.gridx = 3; gbc.gridy = 2; gbc.gridheight = 2; gbc.gridwidth = 3; frame2.setBackground(Color.WHITE); frame2.add(backgroundImage, gbc); JLabel rollDiceImage = new javax.swing.JLabel(); rollDiceImage.setIcon( new javax.swing.ImageIcon(getClass().getClassLoader().getResource("images/rollDice.jpg"))); gbc.gridx = 2; gbc.gridy = 5; gbc.gridheight = 3; gbc.gridwidth = 3; frame2.add(rollDiceImage, gbc); JLabel quitEducationImage = new javax.swing.JLabel(); quitEducationImage.setIcon( new javax.swing.ImageIcon( getClass().getClassLoader().getResource("images/quitEducation.jpg"))); gbc.gridx = 6; gbc.gridy = 5; gbc.gridheight = 3; gbc.gridwidth = 3; frame2.add(quitEducationImage, gbc); exitApplication.setFont(boldFont); saveCareerProspects.setFont(boldFont); saveCareerProspects.setForeground(Color.ORANGE); exitApplication.setBackground(Color.BLACK); exitApplication.setForeground(Color.RED); Border border = new LineBorder(Color.LIGHT_GRAY, 5); exitApplication.setBorder(border); saveCareerProspects.setBorder(border); start.setBorder(border); howToPlay.setBorder(border); playButton.setBorder(border); exitButton.setBorder(border); howToPlay.setFont(boldFont); playButton.setFont(boldFont); exitButton.setFont(boldFont); border = new LineBorder(Color.ORANGE, 5); playerName.setBorder(border); // Adds the fields to the panel // Adds all the panels to the container welcome.add(loading); container.add(start); container.add(frame); container2.add(frame2); container3.add(frame3); // Action Listeners for the buttons howToPlay.addActionListener(this); playButton.addActionListener(this); exitButton.addActionListener(this); quitEducation.addActionListener(this); rollDice.addActionListener(this); saveCareerProspects.addActionListener(this); exitApplication.addActionListener(this); // Starts up the UI startGui(); print(); }
public void reset_labelState() { for (int i = 2; i < 12; i++) { labels[i].setBorder(BorderFactory.createMatteBorder(0, 0, 0, 0, Color.BLUE)); label_state.put(labels[i], 0); } }
/** Display a frame for browsing issues. */ private JPanel constructView() { // sort the original issues list final SortedList<Issue> issuesSortedList = new SortedList<Issue>(issuesEventList, null); // filter the sorted issues FilterList<Issue> filteredIssues = new FilterList<Issue>(issuesSortedList, filterPanel.getMatcherEditor()); SeparatorList<Issue> separatedIssues = new SeparatorList<Issue>( filteredIssues, GlazedLists.beanPropertyComparator(Issue.class, "subcomponent"), 0, Integer.MAX_VALUE); EventList<Issue> separatedIssuesProxyList = GlazedListsSwing.swingThreadProxyList(separatedIssues); // build the issues table issuesTableModel = GlazedListsSwing.eventTableModel(separatedIssuesProxyList, new IssueTableFormat()); final TableColumnModel issuesTableColumnModel = new EventTableColumnModel<TableColumn>(new BasicEventList<TableColumn>()); JSeparatorTable issuesJTable = new JSeparatorTable(issuesTableModel, issuesTableColumnModel); issuesJTable.setAutoCreateColumnsFromModel(true); issuesJTable.setSeparatorRenderer(new IssueSeparatorTableCell(separatedIssues)); issuesJTable.setSeparatorEditor(new IssueSeparatorTableCell(separatedIssues)); issuesSelectionModel = GlazedListsSwing.eventSelectionModel(separatedIssuesProxyList); issuesSelectionModel.setSelectionMode( ListSelection .MULTIPLE_INTERVAL_SELECTION_DEFENSIVE); // multi-selection best demos our awesome // selection management issuesSelectionModel.addListSelectionListener(new IssuesSelectionListener()); issuesJTable.setSelectionModel(issuesSelectionModel); issuesJTable.getColumnModel().getColumn(0).setPreferredWidth(150); issuesJTable.getColumnModel().getColumn(1).setPreferredWidth(400); issuesJTable.getColumnModel().getColumn(2).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(3).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(4).setPreferredWidth(250); issuesJTable.getColumnModel().getColumn(5).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(6).setPreferredWidth(300); issuesJTable.getColumnModel().getColumn(7).setPreferredWidth(1000); // turn off cell focus painting issuesJTable.setDefaultRenderer( String.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(String.class))); issuesJTable.setDefaultRenderer( Integer.class, new NoFocusRenderer(issuesJTable.getDefaultRenderer(Integer.class))); issuesJTable.setDefaultRenderer( Priority.class, new NoFocusRenderer(new PriorityTableCellRenderer())); LookAndFeelTweaks.tweakTable(issuesJTable); TableComparatorChooser.install( issuesJTable, issuesSortedList, TableComparatorChooser.MULTIPLE_COLUMN_KEYBOARD); JScrollPane issuesTableScrollPane = new JScrollPane( issuesJTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); issuesTableScrollPane.getViewport().setBackground(UIManager.getColor("EditorPane.background")); issuesTableScrollPane.setBorder(BorderFactory.createEmptyBorder()); issueDetails = new IssueDetailsComponent(filteredIssues); // projects EventList<Project> projects = Project.getProjects(); TransformedList<Project, Project> projectsProxyList = GlazedListsSwing.swingThreadProxyList(projects); // project select combobox DefaultEventComboBoxModel projectsComboModel = new DefaultEventComboBoxModel<Project>(projectsProxyList); JComboBox projectsCombo = new JComboBox(projectsComboModel); projectsCombo.setEditable(false); projectsCombo.setOpaque(false); projectsCombo.addItemListener(new ProjectChangeListener()); projectsComboModel.setSelectedItem(new Project(null, "Select a Java.net project...")); // build a label to display the number of issues in the issue table issueCounter = new IssueCounterLabel(filteredIssues); issueCounter.setHorizontalAlignment(SwingConstants.CENTER); issueCounter.setForeground(Color.WHITE); // throbber throbber = new JLabel(THROBBER_STATIC); throbber.setHorizontalAlignment(SwingConstants.RIGHT); // header bar JPanel iconBar = new GradientPanel(GLAZED_LISTS_MEDIUM_BROWN, GLAZED_LISTS_DARK_BROWN, true); iconBar.setLayout(new GridLayout(1, 3)); iconBar.add(projectsCombo); iconBar.add(issueCounter); iconBar.add(throbber); iconBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); // assemble all data components on a common panel JPanel dataPanel = new JPanel(); JComponent issueDetailsComponent = issueDetails; dataPanel.setLayout(new GridLayout(2, 1)); dataPanel.add(issuesTableScrollPane); dataPanel.add(issueDetailsComponent); // draw lines between components JComponent filtersPanel = filterPanel.getComponent(); filtersPanel.setBorder(BorderFactory.createEmptyBorder()); // filtersPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 0, 1, // IssuesBrowser.GLAZED_LISTS_DARK_BROWN)); issueDetailsComponent.setBorder( BorderFactory.createMatteBorder(1, 0, 0, 0, GLAZED_LISTS_DARK_BROWN)); // the outermost panel to layout the icon bar with the other panels final JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.add( iconBar, new GridBagConstraints( 0, 0, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( filtersPanel, new GridBagConstraints( 0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( Box.createHorizontalStrut(240), new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mainPanel.add( dataPanel, new GridBagConstraints( 1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); return mainPanel; }