List of usage examples for javax.swing JPanel setPreferredSize
@BeanProperty(preferred = true, description = "The preferred size of the component.") public void setPreferredSize(Dimension preferredSize)
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
public void initMapPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;//from w w w . j a v a 2 s. c o m bPanel = new JPanel(new BorderLayout()); mapPanel = new JPanel(new GridLayout(2, 5, 50, 50)); bPanel.add(mapPanel, BorderLayout.CENTER); // bPanel.add(new JPanel(),BorderLayout.NORTH); addButton1.addActionListener(this); addButton2.addActionListener(this); addButton3.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); removeButton3.addActionListener(this); lModelAdded = new DefaultListModel(); lModelDep = new DefaultListModel(); lModelIndep = new DefaultListModel(); lModelPullout = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModelAdded); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModelDep); listIndepRemoved = new JList(lModelIndep); listPulloutRemoved = new JList(lModelPullout); paintTable(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); listPulloutRemoved.setFixedCellWidth(cellWidth); tools1 = new JToolBar(JToolBar.VERTICAL); tools2 = new JToolBar(JToolBar.VERTICAL); tools3 = new JToolBar(JToolBar.VERTICAL); if (mapDep) { tools1.add(depLabel); tools1.add(addButton1); tools1.add(removeButton1); } if (mapIndep) { tools2.add(indLabel); tools2.add(addButton2); tools2.add(removeButton2); } if (mapPullout) { tools3.add(pulloutLabel); tools3.add(addButton3); tools3.add(removeButton3); } tools1.setFloatable(false); tools2.setFloatable(false); tools3.setFloatable(false); /* topPanel.add(listAdded); topPanel.add(addButton); topPanel.add(listDepRemoved); bottomPanel.add(listIndepRemoved); bottomPanel.add(addButton2); bottomPanel.add(list4); */ JRadioButton legendPanelOnSwitch; JRadioButton legendPanelOffSwitch; // JPanel choicesPanel = new JPanel(); choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS)); legendPanelOnSwitch = new JRadioButton("On"); legendPanelOnSwitch.addActionListener(this); legendPanelOnSwitch.setActionCommand(LEGENDON); legendPanelOnSwitch.setSelected(false); legendPanelOn = false; legendPanelOffSwitch = new JRadioButton("Off"); legendPanelOffSwitch.addActionListener(this); legendPanelOffSwitch.setActionCommand(LEGENDOFF); legendPanelOffSwitch.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(legendPanelOnSwitch); group.add(legendPanelOffSwitch); choicesPanel.add(new JLabel("Turn the legend panel:")); choicesPanel.add(legendPanelOnSwitch); choicesPanel.add(legendPanelOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JRadioButton rotateOnSwitch; JRadioButton rotateOffSwitch; // JPanel rotateChoicesPanel = new JPanel(); rotateChoicesPanel.setLayout(new BoxLayout(rotateChoicesPanel, BoxLayout.Y_AXIS)); rotateOnSwitch = new JRadioButton("On"); rotateOnSwitch.addActionListener(this); rotateOnSwitch.setActionCommand(ROTATEON); rotateOnSwitch.setSelected(false); rotateOn = false; rotateOffSwitch = new JRadioButton("Off"); rotateOffSwitch.addActionListener(this); rotateOffSwitch.setActionCommand(ROTATEOFF); rotateOffSwitch.setSelected(true); ButtonGroup group2 = new ButtonGroup(); group2.add(rotateOnSwitch); group2.add(rotateOffSwitch); choicesPanel.add(new JLabel("Turn the rotator:")); choicesPanel.add(rotateOnSwitch); choicesPanel.add(rotateOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JPanel emptyPanel = new JPanel(); JPanel emptyPanel2 = new JPanel(); JPanel emptyPanel3 = new JPanel(); //2X5 //first line mapPanel.add(new JScrollPane(listAdded)); mapPanel.add(tools1); mapPanel.add(new JScrollPane(listDepRemoved)); mapPanel.add(tools3); if (mapPullout) mapPanel.add(new JScrollPane(listPulloutRemoved)); else mapPanel.add(emptyPanel); //second line-- mapPanel.add(choicesPanel); mapPanel.add(tools2); mapPanel.add(new JScrollPane(listIndepRemoved)); mapPanel.add(emptyPanel2); mapPanel.add(emptyPanel3); }
From source file:de.adv_online.aaa.katalogtool.KatalogDialog.java
private Component createStartPanel() { final JPanel startPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 20, 20)); //startPanel.sets startButton = new JButton("Process EAP"); startButton.setActionCommand("START"); startButton.addActionListener(this); startPanel.add(startButton);/*from w ww .ja v a 2 s .com*/ viewLogButton = new JButton("View Log"); viewLogButton.setActionCommand("LOG"); viewLogButton.addActionListener(this); viewLogButton.setEnabled(false); startPanel.add(viewLogButton); exitButton = new JButton("Exit"); exitButton.setActionCommand("EXIT"); exitButton.addActionListener(this); exitButton.setEnabled(true); startPanel.add(exitButton); startPanel.setPreferredSize(new Dimension(10, 60)); return startPanel; }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * *///from w ww.ja v a2 s .co m private void createComponents() { // creat popup menus { popupMenu = new JPopupMenu(); removeMenuItem = new JMenuItem(I18N .getGUILabel("plotter.configuration_dialog.color_scheme_dialog.remove_color_menu_item.label")); removeMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { removeSelectedColorAction(); } }); popupMenu.add(removeMenuItem); changeColorMenuItem = new JMenuItem(I18N .getGUILabel("plotter.configuration_dialog.color_scheme_dialog.change_color_menu_item.label")); changeColorMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { replaceSelectedColorAction(); } }); popupMenu.add(changeColorMenuItem); popupMenu.addSeparator(); moveUpColorMenuItem = new JMenuItem( I18N.getGUILabel("plotter.configuration_dialog.color_scheme_dialog.move_up_menu_item.label")); moveUpColorMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { moveSelectedColorUpAction(); } }); popupMenu.add(moveUpColorMenuItem); moveDownColorMenuItem = new JMenuItem( I18N.getGUILabel("plotter.configuration_dialog.color_scheme_dialog.move_down_menu_item.label")); moveDownColorMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { moveSelectedColorDownAction(); } }); popupMenu.add(moveDownColorMenuItem); } JPanel containerPanel = new JPanel(new GridBagLayout()); containerPanel.setPreferredSize(new Dimension(520, 450)); // create containing panel { { JPanel configurePanel = new JPanel(new GridBagLayout()); configurePanel.setPreferredSize(new Dimension(220, 400)); configurePanel.setBorder(BorderFactory.createTitledBorder(I18N.getGUILabel( "plotter.configuration_dialog.color_scheme_dialog.scheme_configuration_border.label"))); // add scheme list panel { JPanel schemeComboBoxPanel = createSchemeComboBoxPanel(); // add category choosing panel GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.insets = new Insets(2, 2, 2, 5); configurePanel.add(schemeComboBoxPanel, itemConstraint); } { categoryAndGradientConfigPanel = new JPanel(new GridBagLayout()); // add categories panel { JPanel categoryConfigurationPanel = createColorCategoriesPanel(); // add category choosing panel GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.insets = new Insets(2, 2, 2, 5); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; categoryAndGradientConfigPanel.add(categoryConfigurationPanel, itemConstraint); } // add gradient chooser panel { JPanel gradientConfigPanel = createGradientConfigurationPanel(); GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.insets = new Insets(2, 2, 2, 5); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; categoryAndGradientConfigPanel.add(gradientConfigPanel, itemConstraint); } GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.insets = new Insets(2, 2, 2, 5); configurePanel.add(categoryAndGradientConfigPanel, itemConstraint); } GridBagConstraints itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; containerPanel.add(configurePanel, itemConstraint); } createPlotPreviewPanel(containerPanel); } // create buttons Collection<AbstractButton> buttons = new LinkedList<AbstractButton>(); buttons.add(makeOkButton()); Action saveAction = new ResourceAction("plotter.configuration_dialog.color_scheme_dialog.save_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { save(currentColorSchemes, currentActiveColorSchemeName); // set new scheme plotConfig.setColorSchemes(currentColorSchemes, currentActiveColorSchemeName); } }; saveButton = new JButton(saveAction); buttons.add(saveButton); saveButton.setEnabled(false); Action revertAction = new ResourceAction("plotter.configuration_dialog.color_scheme_dialog.revert_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { revert(); } }; revertButton = new JButton(revertAction); revertButton.setEnabled(false); buttons.add(revertButton); buttons.add(makeCancelButton("plotter.configuration_dialog.color_scheme_dialog.cancel_button")); layoutDefault(containerPanel, buttons); }
From source file:net.panthema.BispanningGame.GamePanel.java
public GamePanel() throws IOException { makeActions();// w w w. j av a 2 s . c o m setBackground(Color.WHITE); ImageAlice = ImageIO.read( getClass().getClassLoader().getResourceAsStream("net/panthema/BispanningGame/images/Alice.png")); ImageBob = ImageIO.read( getClass().getClassLoader().getResourceAsStream("net/panthema/BispanningGame/images/Bob.png")); logTextArea = new JTextArea(); makeNewRandomGraph(8); mLayout = MyGraphLayoutFactory(mGraph); mVV = new VisualizationViewer<Integer, MyEdge>(mLayout); mVV.setSize(new Dimension(1000, 800)); mVV.setBackground(Color.WHITE); // Bob's play does not repeat. mPlayBob.setRepeats(false); // set up mouse handling PluggableGraphMouse gm = new PluggableGraphMouse(); gm.add(new MyEditingGraphMousePlugin<Integer, MyEdge>(MouseEvent.CTRL_MASK, new MyVertexFactory(), new MyEdgeFactory())); gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK)); gm.add(new MyGraphMousePlugin(MouseEvent.BUTTON1_MASK | MouseEvent.BUTTON3_MASK)); gm.add(new PickingGraphMousePlugin<Integer, MyEdge>()); gm.add(new ScalingGraphMousePlugin(new LayoutScalingControl(), 0, 1.1f, 0.9f)); mVV.setGraphMouse(gm); // set vertex and label drawing mVV.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.black)); mVV.getRenderContext().setVertexLabelTransformer(new Transformer<Integer, String>() { public String transform(Integer v) { return "v" + v; } }); mVV.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Integer>()); mVV.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); mVV.getRenderer().setEdgeRenderer(new MyEdgeRenderer()); mVV.getRenderContext().setVertexDrawPaintTransformer(new MyVertexDrawPaintTransformer<Integer>()); mVV.getRenderContext().setVertexFillPaintTransformer(new MyVertexFillPaintTransformer()); mVV.getRenderContext().setEdgeStrokeTransformer(new MyEdgeStrokeTransformer()); MyQuadCurve<Integer, MyEdge> quadcurve = new MyQuadCurve<Integer, MyEdge>(); mVV.getRenderContext().setEdgeShapeTransformer(quadcurve); mVV.getRenderContext().setParallelEdgeIndexFunction(quadcurve); mVV.getRenderContext().setEdgeDrawPaintTransformer(new MyEdgeDrawPaintTransformer()); mVV.getRenderContext().setEdgeFillPaintTransformer(new MyEdgeFillPaintTransformer()); mVV.getRenderContext().setEdgeArrowStrokeTransformer(new MyEdgeInnerStrokeTransformer()); mVV.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.black)); mVV.getRenderContext().setEdgeLabelTransformer(new Transformer<MyEdge, String>() { public String transform(MyEdge e) { return e.toString(); } }); mVV.getRenderContext().setLabelOffset(6); // create pick support to select closest nodes and edges mPickSupport = new ShapePickSupport<Integer, MyEdge>(mVV, mPickDistance); // add pre renderer to draw Alice and Bob mVV.addPreRenderPaintable(new MyGraphPreRenderer()); // add post renderer to show error messages in background mVV.addPostRenderPaintable(new MyGraphPostRenderer()); setLayout(new BorderLayout()); add(mVV, BorderLayout.CENTER); JPanel panelSouth = new JPanel(); add(panelSouth, BorderLayout.SOUTH); panelSouth.setLayout(new GridLayout(0, 2, 0, 0)); JPanel panelButtons = new JPanel(); panelSouth.add(panelButtons); panelButtons.setLayout(new GridLayout(2, 2, 0, 0)); panelSouth.setPreferredSize(new Dimension(800, 60)); final JButton btnNewRandomGraph = new JButton("New Random Graph"); btnNewRandomGraph.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JPopupMenu popup = new JPopupMenu(); for (int i = 0; i < actionRandomGraph.length; ++i) { if (actionRandomGraph[i] != null) popup.add(actionRandomGraph[i]); } popup.addSeparator(); popup.add(getActionNewGraphType()); popup.show(btnNewRandomGraph, e.getX(), e.getY()); } }); panelButtons.add(btnNewRandomGraph); final JButton btnNewNamedGraph = new JButton("New Named Graph"); btnNewNamedGraph.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JPopupMenu popup = new JPopupMenu(); for (int i = 0; i < actionNamedGraph.size(); ++i) { if (actionNamedGraph.get(i) != null) popup.add(actionNamedGraph.get(i)); } popup.show(btnNewNamedGraph, e.getX(), e.getY()); } }); panelButtons.add(btnNewNamedGraph); final JButton btnRelayout = new JButton("Relayout"); btnRelayout.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { relayoutGraph(); } }); panelButtons.add(btnRelayout); final JButton btnOptions = new JButton("Options"); btnOptions.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { JPopupMenu popup = new JPopupMenu(); addPopupActions(popup); popup.addSeparator(); popup.show(btnOptions, e.getX(), e.getY()); } }); panelButtons.add(btnOptions); JScrollPane scrollPane = new JScrollPane(logTextArea); panelSouth.add(scrollPane); logTextArea.setEditable(false); setSize(new Dimension(1000, 800)); relayoutGraph(); }
From source file:edu.ucla.stat.SOCR.analyses.gui.AnovaTwoWay.java
protected void setMappingPanel() { listIndex = new int[dataTable.getColumnCount()]; for (int j = 0; j < listIndex.length; j++) listIndex[j] = 1;/*from w ww . j av a2 s . c o m*/ bPanel = new JPanel(new BorderLayout()); bPanel.add(mappingPanel, BorderLayout.CENTER); mappingPanel.add(mappingInnerPanel, BorderLayout.CENTER); addButton1.addActionListener(this); addButton2.addActionListener(this); removeButton1.addActionListener(this); removeButton2.addActionListener(this); lModel1 = new DefaultListModel(); lModel2 = new DefaultListModel(); lModel3 = new DefaultListModel(); int cellWidth = 10; listAdded = new JList(lModel1); listAdded.setSelectedIndex(0); listDepRemoved = new JList(lModel2); listIndepRemoved = new JList(lModel3); paintTable(listIndex); listAdded.setFixedCellWidth(cellWidth); listDepRemoved.setFixedCellWidth(cellWidth); listIndepRemoved.setFixedCellWidth(cellWidth); dependentPane = new JScrollPane(listDepRemoved); FIRST_BUTTON_LABEL = "DEPENDENT"; SECOND_BUTTON_LABEL = "INDEPENDENT"; depLabel = new JLabel(FIRST_BUTTON_LABEL); indLabel = new JLabel(SECOND_BUTTON_LABEL); tools1.add(depLabel); tools2.add(indLabel); tools1.add(addButton1); tools1.add(removeButton1); tools2.add(addButton2); tools2.add(removeButton2); tools1.setFloatable(false); tools2.setFloatable(false); // JPanel choicesPanel = new JPanel(); choicesPanel.setLayout(new BoxLayout(choicesPanel, BoxLayout.Y_AXIS)); interactionOnSwitch = new JRadioButton("On"); interactionOnSwitch.addActionListener(this); interactionOnSwitch.setActionCommand(INTERACTIONON); interactionOnSwitch.setSelected(false); interactionOn = false; interactionOffSwitch = new JRadioButton("Off"); interactionOffSwitch.addActionListener(this); interactionOffSwitch.setActionCommand(INTERACTIONOFF); interactionOffSwitch.setSelected(true); ButtonGroup group = new ButtonGroup(); group.add(interactionOnSwitch); group.add(interactionOffSwitch); choicesPanel.add(new JLabel("Turn the interaction:")); choicesPanel.add(interactionOnSwitch); choicesPanel.add(interactionOffSwitch); choicesPanel.setPreferredSize(new Dimension(200, 100)); JPanel emptyPanel = new JPanel(); //mappingInnerPanel.setBackground(Color.RED); mappingInnerPanel.add(new JScrollPane(listAdded)); mappingInnerPanel.add(tools1); mappingInnerPanel.add(dependentPane); // mappingInnerPanel.add(emptyPanel); mappingInnerPanel.add(choicesPanel); mappingInnerPanel.add(tools2); mappingInnerPanel.add(new JScrollPane(listIndepRemoved)); //listIndepRemoved.setBackground(Color.GREEN); }
From source file:com.sshtools.shift.FileTransferDialog.java
private void jbInit() throws Exception { getContentPane().setLayout(new BorderLayout()); progressbar.setToolTipText(""); progressbar.setValue(0);//ww w .j av a2 s.c o m try { Method m = progressbar.getClass().getMethod("setIndeterminate", new Class[] { boolean.class }); Object[] args = new Object[] { new Boolean(true) }; m.invoke(progressbar, args); } catch (Throwable ex) { } //progressbar.setIndeterminate(true); progressbar.setBounds(new Rectangle(8, 45, 336, 22)); lblEstimatedTime.setText("Estimated time left: "); lblEstimatedTime.setBounds(new Rectangle(8, 74, 114, 17)); lblTimeLeftValue.setText(""); lblTimeLeftValue.setBounds(new Rectangle(109, 74, 235, 17)); lblTargetAction.setText("Downloading to:"); lblTargetAction.setBounds(new Rectangle(8, 92, 96, 17)); lblTargetValue.setText(""); lblTargetValue.setBounds(new Rectangle(109, 92, 235, 17)); lblTransferRate.setText("Transfer rate: "); lblTransferRate.setBounds(new Rectangle(8, 110, 96, 17)); lblTransferRateValue.setText(""); lblTransferRateValue.setBounds(new Rectangle(109, 110, 235, 17)); btnCancel.setText("Cancel"); btnCancel.addActionListener(new FileTransferDialog_cancel_actionAdapter( this)); chkClose.setText("Close this window when the transfer completes"); chkClose.setBounds(new Rectangle(8, 132, 307, 18)); chkClose.setSelected(true); JPanel p = new JPanel(null); lblAction.setBounds(new Rectangle(9, 5, 334, 21)); lblPathValue.setText(""); lblPathValue.setBounds(new Rectangle(10, 22, 329, 22)); p.add(progressbar); p.add(lblEstimatedTime); p.add(lblTimeLeftValue); p.add(lblTargetAction); p.add(lblTransferRate); p.add(lblTransferRateValue); p.add(lblTargetValue); p.add(lblAction); p.add(lblPathValue); p.add(chkClose); JPanel b = new JPanel(new FlowLayout(FlowLayout.RIGHT)); b.add(btnCancel); p.setMaximumSize(new Dimension(350, 185)); p.setMinimumSize(new Dimension(350, 185)); p.setPreferredSize(new Dimension(350, 185)); getContentPane().add(p, BorderLayout.CENTER); getContentPane().add(b, BorderLayout.SOUTH); elaspedTime = 0; formatMb.setMaximumFractionDigits(2); formatKb.setMaximumFractionDigits(0); formatKb1.setMaximumFractionDigits(1); setResizable(true); setSize(new Dimension(350, 184)); UIUtil.positionComponent(UIUtil.CENTER, this); }
From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java
/** * @return/* w w w. j a v a 2 s .c om*/ */ private JPanel createColorCategoriesPanel() { JPanel categoryColorsConfigurationPanel = new JPanel(new GridBagLayout()); categoryColorsConfigurationPanel.setPreferredSize(new Dimension(180, 200)); GridBagConstraints itemConstraint = new GridBagConstraints(); JLabel categoryColorsLabel = new ResourceLabel( "plotter.configuration_dialog.color_scheme_dialog.category_colors"); { itemConstraint.fill = GridBagConstraints.HORIZONTAL; itemConstraint.anchor = GridBagConstraints.WEST; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.insets = new Insets(0, 5, 5, 5); itemConstraint.weightx = 1.0; categoryColorsConfigurationPanel.add(categoryColorsLabel, itemConstraint); } // add button panel { JPanel buttonPanel = new JPanel(new GridBagLayout()); // remove scheme button { removeCategoryColorButton = new JButton(new ResourceAction(true, "plotter.configuration_dialog.color_scheme_dialog.remove_category_color_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { removeSelectedColorAction(); } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.RELATIVE; itemConstraint.fill = GridBagConstraints.NONE; buttonPanel.add(removeCategoryColorButton, itemConstraint); } { addCategoryButton = new JButton(new ResourceAction(true, "plotter.configuration_dialog.color_scheme_dialog.add_category_color_button") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { Color oldColor = Color.white; Color newSchemeColor = createColorDialog(oldColor); if (newSchemeColor != null && !newSchemeColor.equals(oldColor)) { addColorAction(newSchemeColor); } } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.fill = GridBagConstraints.NONE; buttonPanel.add(addCategoryButton, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.anchor = GridBagConstraints.EAST; itemConstraint.insets = new Insets(0, 5, 5, 5); categoryColorsConfigurationPanel.add(buttonPanel, itemConstraint); } { JPanel categoryListPanel = new JPanel(new GridBagLayout()); // add list of categorie colors { colorList = new JList<Color>(nominalColorListModel); categoryColorsLabel.setLabelFor(colorList); colorList.setCellRenderer(new ColorListCellRenderer()); colorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); MouseAdapter ma = new MouseAdapter() { private void myPopupEvent(MouseEvent e) { int x = e.getX(); int y = e.getY(); JList<?> list = (JList<?>) e.getSource(); list.setSelectedIndex(list.locationToIndex(e.getPoint())); Color selectedColor = (Color) list.getSelectedValue(); if (selectedColor == null) { return; } removeMenuItem.setEnabled(nominalColorListModel.getSize() > 2); popupMenu.show(list, x, y); } @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { myPopupEvent(e); } } @Override public void mouseReleased(MouseEvent e) { if (e.isPopupTrigger()) { myPopupEvent(e); } } }; colorList.addMouseListener(ma); colorList.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { return; // Nothing to be done } @Override public void keyReleased(KeyEvent e) { return; // Nothing to be done } @Override public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_DELETE) { if (nominalColorListModel.getSize() > 2) { removeSelectedColorAction(); } } if (key == KeyEvent.VK_F2) { replaceSelectedColorAction(); } if (key == KeyEvent.VK_UP && SwingTools.isControlOrMetaDown(e)) { moveSelectedColorUpAction(); } if (key == KeyEvent.VK_DOWN && SwingTools.isControlOrMetaDown(e)) { moveSelectedColorDownAction(); } } }); colorListScrollPane = new JScrollPane(colorList); colorListScrollPane.setPreferredSize(new Dimension(170, 200)); colorListScrollPane.setMaximumSize(new Dimension(170, 200)); colorListScrollPane.setMinimumSize(new Dimension(170, 180)); colorListScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); colorListScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); itemConstraint = new GridBagConstraints(); itemConstraint.fill = GridBagConstraints.BOTH; itemConstraint.weightx = 0.0; itemConstraint.weighty = 0.5; itemConstraint.gridwidth = GridBagConstraints.RELATIVE; categoryListPanel.add(colorListScrollPane, itemConstraint); } // add up/down button panel { JPanel upAndDownButtonPanel = new JPanel(new GridBagLayout()); // add up button { JButton upButton = new JButton( new ResourceAction(true, "plotter.configuration_dialog.move_color_up") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { moveSelectedColorUpAction(); } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.weightx = 0; itemConstraint.weighty = 0; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.insets = new Insets(0, 2, 0, 12); upAndDownButtonPanel.add(upButton, itemConstraint); } // add down button { JButton downButton = new JButton( new ResourceAction(true, "plotter.configuration_dialog.move_color_down") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { moveSelectedColorDownAction(); } }); itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.weightx = 0; itemConstraint.weighty = 0; itemConstraint.fill = GridBagConstraints.NONE; itemConstraint.insets = new Insets(0, 2, 0, 12); upAndDownButtonPanel.add(downButton, itemConstraint); } // add spacer panel { JPanel spacer = new JPanel(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.weightx = 0; itemConstraint.weighty = 1; itemConstraint.fill = GridBagConstraints.VERTICAL; upAndDownButtonPanel.add(spacer, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.fill = GridBagConstraints.VERTICAL; categoryListPanel.add(upAndDownButtonPanel, itemConstraint); } itemConstraint = new GridBagConstraints(); itemConstraint.gridwidth = GridBagConstraints.REMAINDER; itemConstraint.weightx = 1; itemConstraint.weighty = 1; itemConstraint.fill = GridBagConstraints.BOTH; categoryColorsConfigurationPanel.add(categoryListPanel, itemConstraint); } return categoryColorsConfigurationPanel; }
From source file:br.org.acessobrasil.ases.ferramentas_de_reparo.vista.script.PainelScript.java
private void initComponentsEscalavel(ArrayList<FerramentaDescricaoModel> erros) { Ferramenta_Scripts.carregaTexto(TokenLang.LANG); JPanel regraFonteBtn = new JPanel(); regraFonteBtn.setLayout(new BorderLayout()); textAreaSourceCode = new G_TextAreaSourceCode(); textAreaSourceCode.setTipoHTML();// w ww . j a v a2 s .co m new OnChange(textAreaSourceCode, this); tableLinCod = new TabelaDescricao(erros); arTextPainelCorrecao = new ArTextPainelCorrecao(); salvar = new JButton(); abrir = new JButton(); cancelar = new JButton(); strConteudoalt = new String(); btnSalvar = new JMenuItem("Salvar"); salvar.setEnabled(false); salvaAlteracoes = TxtBuffer.getInstanciaSalvaAlteracoes(textAreaSourceCode.getTextPane(), salvar, new JMenuItem(), parentFrame); pnRegra = new JPanel(); lbRegras1 = new JLabel(); lbRegras2 = new JLabel(); pnSetaDescricao = new JPanel(); new JScrollPane(); tArParticipRotulo = new TArParticipRotulo(); conteudoDoAlt = new JTextArea(); pnListaErros = new JPanel(); scrollPanetabLinCod = new JScrollPane(); pnBotoes = new JPanel(); new JButton(); aplicar = new JButton(); conteudoParticRotulo = new ArrayList<String>(); setBackground(CoresDefault.getCorPaineis()); Container contentPane = this;// ?? contentPane.setLayout(new GridLayout(2, 1)); { pnRegra.setBorder(criaBorda(Ferramenta_Scripts.TITULO_REGRA)); pnRegra.setLayout(new GridLayout(2, 1)); pnRegra.add(lbRegras1); lbRegras1.setText(Ferramenta_Scripts.REGRAP1); lbRegras2.setText(Ferramenta_Scripts.REGRAP2); lbRegras1.setHorizontalAlignment(SwingConstants.CENTER); lbRegras2.setHorizontalAlignment(SwingConstants.CENTER); pnRegra.add(lbRegras1); pnRegra.add(lbRegras2); pnRegra.setPreferredSize(new Dimension(700, 60)); } // ---- Salvar ---- salvar.setText(Ferramenta_Scripts.BTN_SALVAR); salvar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { salvarActionPerformed(e); } }); salvar.setToolTipText(Ferramenta_Scripts.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_SALVAR); salvar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_SALVAR); salvar.setBounds(10, 0, 150, 25); abrir.setText(Ferramenta_Scripts.BTN_ABRIR); abrir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { AbrirActionPerformed(e); } }); abrir.setToolTipText(Ferramenta_Scripts.DICA_ABRIR); abrir.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_ABRIR_HTML); abrir.setBounds(165, 0, 150, 25); cancelar.setText(Ferramenta_Imagens.TELA_ANTERIOR); cancelar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { CancelarActionPerformed(e); } }); cancelar.setToolTipText(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleDescription(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.getAccessibleContext().setAccessibleName(Ferramenta_Imagens.DICA_TELA_ANTERIOR); cancelar.setBounds(320, 0, 150, 25); GridBagConstraints cons = new GridBagConstraints(); cons.fill = GridBagConstraints.BOTH; cons.weighty = 1; pnSetaDescricao.setLayout(new BorderLayout()); cons.anchor = GridBagConstraints.WEST; cons.insets = new Insets(0, 0, 0, 0); JScrollPane sp = new JScrollPane(); sp.setBorder(criaBorda(Ferramenta_Scripts.CONTEUDO_ALTER)); sp.setViewportView(conteudoDoAlt); sp.setPreferredSize(new Dimension(500, 300)); pnSetaDescricao.setPreferredSize(new Dimension(400, 60)); pnListaErros.setBorder(criaBorda(Ferramenta_Scripts.LISTA_ERROS)); pnListaErros.setLayout(new BorderLayout()); scrollPanetabLinCod.setViewportView(tableLinCod); pnListaErros.add(scrollPanetabLinCod, BorderLayout.CENTER); { pnBotoes.setLayout(null); aplicar.setEnabled(false); aplicar.setText(Ferramenta_Scripts.BTN_APLICAR); aplicar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { aplicarRotuloActionPerformed(e); } }); aplicar.setToolTipText(Ferramenta_Scripts.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleDescription(Ferramenta_Scripts.DICA_APLICAR); aplicar.getAccessibleContext().setAccessibleName(Ferramenta_Scripts.DICA_APLICAR); aplicar.setBounds(3, 3, 120, 30); pnBotoes.add(aplicar); } /* * Colocar os controles */ pnRegra.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.add(pnRegra, BorderLayout.NORTH); textAreaSourceCode.setBorder(criaBorda("")); textAreaSourceCode.setBackground(CoresDefault.getCorPaineis()); JSplitPane splitPane = null; Dimension minimumSize = new Dimension(0, 0); sp.setMinimumSize(minimumSize); sp.setPreferredSize(new Dimension(150, 90)); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sp, textAreaSourceCode); splitPane.setOneTouchExpandable(true); int w = parentFrame.getWidth(); int s = w / 4; splitPane.setDividerLocation(s); regraFonteBtn.add(splitPane, BorderLayout.CENTER); pnBotoes.setPreferredSize(new Dimension(600, 35)); pnBotoes.setBackground(CoresDefault.getCorPaineis()); regraFonteBtn.setBackground(CoresDefault.getCorPaineis()); contentPane.add(regraFonteBtn); JPanel textoErrosBtn = new JPanel(); textoErrosBtn.setLayout(new BorderLayout()); pnSetaDescricao.setBackground(CoresDefault.getCorPaineis()); pnSetaDescricao.add(pnBotoes, BorderLayout.WEST); textoErrosBtn.add(pnSetaDescricao, BorderLayout.NORTH); textoErrosBtn.add(pnListaErros, BorderLayout.CENTER); JPanel pnSalvarCancelar = new JPanel(); pnSalvarCancelar.setLayout(null); pnSalvarCancelar.setPreferredSize(new Dimension(600, 35)); pnSalvarCancelar.add(salvar); pnSalvarCancelar.add(abrir); pnSalvarCancelar.add(cancelar); if (!original) { reverter = new JButton("Reverter"); reverter.setText(TradPainelRelatorio.REVERTER); reverter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); TxtBuffer.setContent(TxtBuffer.getContentOriginal()); parentFrame.showPainelFerramentaScriptPArq(TxtBuffer.getContentOriginal()); setVisible(true); } }); reverter.setToolTipText(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleDescription(TradPainelRelatorio.DICA_REVERTER); reverter.getAccessibleContext().setAccessibleName(TradPainelRelatorio.DICA_REVERTER); reverter.setBounds(485, 0, 150, 25); pnSalvarCancelar.add(reverter); } pnSalvarCancelar.setBackground(CoresDefault.getCorPaineis()); textoErrosBtn.add(pnSalvarCancelar, BorderLayout.SOUTH); pnListaErros.setBackground(CoresDefault.getCorPaineis()); if (tableLinCod.getRowCount() == 0) tableLinCod.addLinha(0, 0, GERAL.DOC_SEM_ERROS); contentPane.setBackground(CoresDefault.getCorPaineis()); contentPane.add(textoErrosBtn); this.setVisible(true); }
From source file:org.biojava.bio.view.MotifAnalyzer.java
private JPanel getInputTab() { inputTab = new JPanel(new GridLayout(1, 1)); ////////////////// {/*from w w w. ja va2 s . co m*/ JPanel generalPar = new JPanel(); inputTab.add(generalPar); GroupLayout inputTabLayout = new GroupLayout((JComponent) generalPar); generalPar.setLayout(inputTabLayout); generalPar.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.black), "General Parameters", 0, 0, new Font(Font.DIALOG, Font.BOLD, 16), Color.black)); generalPar.setPreferredSize(new java.awt.Dimension(787, 291)); inputTabLayout.setHorizontalGroup(inputTabLayout.createSequentialGroup().addContainerGap(12, 12) .addGroup(inputTabLayout.createParallelGroup() .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getCheckReverse(), GroupLayout.PREFERRED_SIZE, 198, GroupLayout.PREFERRED_SIZE) .addGap(250)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getMultipleDataSets(), GroupLayout.PREFERRED_SIZE, 193, GroupLayout.PREFERRED_SIZE) .addGap(255)) .addGroup(inputTabLayout.createSequentialGroup() .addGroup(inputTabLayout.createParallelGroup() .addComponent(getJLabel1(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 187, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel8(), GroupLayout.PREFERRED_SIZE, 113, GroupLayout.PREFERRED_SIZE) .addGap(74)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel7(), GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE) .addGap(107)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel2(), GroupLayout.PREFERRED_SIZE, 128, GroupLayout.PREFERRED_SIZE) .addGap(59)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel3(), GroupLayout.PREFERRED_SIZE, 148, GroupLayout.PREFERRED_SIZE) .addGap(39)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel4(), GroupLayout.PREFERRED_SIZE, 137, GroupLayout.PREFERRED_SIZE) .addGap(50)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel6(), GroupLayout.PREFERRED_SIZE, 126, GroupLayout.PREFERRED_SIZE) .addGap(61)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel5(), GroupLayout.PREFERRED_SIZE, 108, GroupLayout.PREFERRED_SIZE) .addGap(79)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getJLabel9(), GroupLayout.PREFERRED_SIZE, 155, GroupLayout.PREFERRED_SIZE) .addGap(32))) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(inputTabLayout.createParallelGroup().addGroup( GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getMinPoints(), GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE) .addGap(134)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getClusteringEpsilon(), GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE) .addGap(134)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout .createSequentialGroup() .addComponent(getNumOfMotifs(), GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addGap(187)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout .createSequentialGroup() .addComponent(getNumOfTrials(), GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addGap(187)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout .createSequentialGroup() .addComponent(getMotifWidth(), GroupLayout.PREFERRED_SIZE, 69, GroupLayout.PREFERRED_SIZE) .addGap(187)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout.createSequentialGroup() .addComponent(getDatasetTypeComboBox(), GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE) .addGap(111)) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout .createSequentialGroup() .addComponent(getDatasetComboBox(), GroupLayout.PREFERRED_SIZE, 145, GroupLayout.PREFERRED_SIZE) .addGap(111)) .addComponent(getSpeciesType(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 256, GroupLayout.PREFERRED_SIZE) .addGroup(GroupLayout.Alignment.LEADING, inputTabLayout .createSequentialGroup() .addComponent(getNumOfClusters(), GroupLayout.PREFERRED_SIZE, 122, GroupLayout.PREFERRED_SIZE) .addGap(134))))) .addContainerGap(317, 317)); inputTabLayout.setVerticalGroup(inputTabLayout.createSequentialGroup().addContainerGap() .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getNumOfMotifs(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel1(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getSpeciesType(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel2(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getNumOfTrials(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 24, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel3(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getMotifWidth(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel4(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 16, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getDatasetTypeComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel6(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getDatasetComboBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel5(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(20) .addComponent(getMultipleDataSets(), GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addGap(19) .addComponent(getCheckReverse(), GroupLayout.PREFERRED_SIZE, 21, GroupLayout.PREFERRED_SIZE) .addGap(16) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getClusteringEpsilon(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel7(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getMinPoints(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel8(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(inputTabLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(getNumOfClusters(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22, GroupLayout.PREFERRED_SIZE) .addComponent(getJLabel9(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) .addContainerGap(65, 65)); } return inputTab; }
From source file:org.jfree.chart.demo.PlotOrientationDemo2.java
/** * Creates a new demo instance./*from ww w . ja va2s. com*/ * * @param title the frame title. */ public PlotOrientationDemo2(String title) { super(title); JPanel panel = new JPanel(new GridLayout(2, 4)); for (int i = 0; i < CHART_COUNT; i++) { this.datasets[i] = createDataset(i); this.charts[i] = createChart(i, this.datasets[i]); XYPlot plot = this.charts[i].getXYPlot(); XYShapeAnnotation a1 = new XYShapeAnnotation(new Rectangle2D.Double(1.0, 2.0, 2.0, 3.0), new BasicStroke(1.0f), Color.blue); XYLineAnnotation a2 = new XYLineAnnotation(0.0, -5.0, 10.0, -5.0); plot.addAnnotation(a1); plot.addAnnotation(a2); plot.addDomainMarker(new IntervalMarker(5.0, 10.0), Layer.BACKGROUND); plot.addRangeMarker(new IntervalMarker(-2.0, 0.0), Layer.BACKGROUND); this.panels[i] = new ChartPanel(this.charts[i]); } this.charts[1].getXYPlot().getDomainAxis().setInverted(true); this.charts[2].getXYPlot().getRangeAxis().setInverted(true); this.charts[3].getXYPlot().getDomainAxis().setInverted(true); this.charts[3].getXYPlot().getRangeAxis().setInverted(true); this.charts[5].getXYPlot().getDomainAxis().setInverted(true); this.charts[6].getXYPlot().getRangeAxis().setInverted(true); this.charts[4].getXYPlot().getDomainAxis().setInverted(true); this.charts[4].getXYPlot().getRangeAxis().setInverted(true); this.charts[4].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[5].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[6].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[7].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); panel.add(this.panels[0]); panel.add(this.panels[1]); panel.add(this.panels[4]); panel.add(this.panels[5]); panel.add(this.panels[2]); panel.add(this.panels[3]); panel.add(this.panels[6]); panel.add(this.panels[7]); panel.setPreferredSize(new Dimension(800, 600)); setContentPane(panel); }