List of usage examples for java.awt GridLayout GridLayout
public GridLayout(int rows, int cols)
From source file:ContainerEventDemo.java
public ContainerEventDemo() { super(new GridBagLayout()); GridBagLayout gridbag = (GridBagLayout) getLayout(); GridBagConstraints c = new GridBagConstraints(); // Initialize an empty list of buttons. buttonList = new Vector<JButton>(10, 10); // Create all the components. addButton = new JButton("Add a button"); addButton.setActionCommand(ADD);//from w w w . ja v a2 s. c om addButton.addActionListener(this); removeButton = new JButton("Remove a button"); removeButton.setActionCommand(REMOVE); removeButton.addActionListener(this); buttonPanel = new JPanel(new GridLayout(1, 1)); buttonPanel.setPreferredSize(new Dimension(200, 75)); buttonPanel.addContainerListener(this); display = new JTextArea(); display.setEditable(false); JScrollPane scrollPane = new JScrollPane(display); scrollPane.setPreferredSize(new Dimension(200, 75)); clearButton = new JButton("Clear text area"); clearButton.setActionCommand(CLEAR); clearButton.addActionListener(this); c.fill = GridBagConstraints.BOTH; // Fill entire cell. c.weighty = 1.0; // Button area and message area have equal height. c.gridwidth = GridBagConstraints.REMAINDER; // end of row gridbag.setConstraints(scrollPane, c); add(scrollPane); c.weighty = 0.0; gridbag.setConstraints(clearButton, c); add(clearButton); c.weightx = 1.0; // Add/remove buttons have equal width. c.gridwidth = 1; // NOT end of row gridbag.setConstraints(addButton, c); add(addButton); c.gridwidth = GridBagConstraints.REMAINDER; // end of row gridbag.setConstraints(removeButton, c); add(removeButton); c.weighty = 1.0; // Button area and message area have equal height. gridbag.setConstraints(buttonPanel, c); add(buttonPanel); setPreferredSize(new Dimension(400, 400)); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedDGView.java
public JPanel getPanel(HomePanel homePanel) { JPanel panel = new JPanel(new BorderLayout()); JPanel headerPanel = homePanel.createHeaderPanel(null, _analysis.tagsAreIncomplete()); panel.add(headerPanel, BorderLayout.NORTH); JPanel gridPanel = new JPanel(new GridLayout(1, 2)); gridPanel.add(_decadeChartPanel);//from w w w .ja va 2 s . co m gridPanel.add(_genreChartPanel); panel.add(gridPanel, BorderLayout.CENTER); return panel; }
From source file:com.sshtools.common.ui.SshToolsConnectionPanel.java
/** * Creates a new SshToolsConnectionPanel object. * * @param showConnectionTabs/*from w w w .j a v a 2 s . co m*/ */ public SshToolsConnectionPanel(boolean showConnectionTabs) { super(); tabber = new Tabber(); if (showConnectionTabs) { // Add the common tabs addTab(hosttab = new SshToolsConnectionHostTab()); /**addTab(new SshToolsConnectionProtocolTab()); THIS ADDS NOTHING BUT CAUSES ERRORS*/ addTab(new SshToolsConnectionProxyTab()); } // Build this panel setLayout(new GridLayout(1, 1)); add(tabber); }
From source file:serverrobot.DynamicGraph.java
public JPanel createPlatformActualPlot() { final TimeSeriesCollection dataset1 = createPlatformRollx2Collection(); final TimeSeriesCollection dataset2 = createPlatformPitchx2Collection(); final JFreeChart chart1 = createChart(dataset1, "Roll", -5, 5); final JFreeChart chart2 = createChart(dataset2, "Pitch", -5, 5); final ChartPanel chartPanel1 = new ChartPanel(chart1); final ChartPanel chartPanel2 = new ChartPanel(chart2); final JPanel panel = new JPanel(new BorderLayout()); final GridLayout grid = new GridLayout(2, 1); panel.setLayout(grid);//from w w w . ja v a 2 s . co m panel.add(chartPanel1); panel.add(chartPanel2); panel.setPreferredSize(new Dimension(1200, 600)); return panel; }
From source file:fungus.MycoNodeFrame.java
public MycoNodeFrame(MycoNode node) { this.node = node; this.setTitle("Node " + node.getID()); graph = JungGraphObserver.getGraph(); Container contentPane = getContentPane(); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); JPanel labelPane = new JPanel(); labelPane.setLayout(new GridLayout(7, 2)); JPanel neighborPane = new JPanel(); neighborPane.setLayout(new BoxLayout(neighborPane, BoxLayout.PAGE_AXIS)); JPanel logPane = new JPanel(); logPane.setLayout(new BoxLayout(logPane, BoxLayout.PAGE_AXIS)); JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); loggingTextArea = new JTextArea("", 25, 100); loggingTextArea.setLineWrap(true);/*from ww w.ja va2s .c om*/ loggingTextArea.setEditable(false); handler = new MycoNodeLogHandler(node, loggingTextArea); handler.addChangeListener(this); JScrollPane logScrollPane = new JScrollPane(loggingTextArea); logScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); logPane.add(logScrollPane); contentPane.add(labelPane); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); contentPane.add(neighborPane); //contentPane.add(Box.createRigidArea(new Dimension(0,5))); contentPane.add(logPane); contentPane.add(buttonPane); data = node.getHyphaData(); link = node.getHyphaLink(); mycocast = node.getMycoCast(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); stateLabel = new JLabel(); typeLabel = new JLabel(); queueLengthLabel = new JLabel(); sameLabel = new JLabel(); differentLabel = new JLabel(); maxCapacityLabel = new JLabel(); idealImmobileLabel = new JLabel(); idealHyphaeLabel = new JLabel(); idealBiomassLabel = new JLabel(); degreeLabel = new JLabel(); hyphaDegreeLabel = new JLabel(); biomassDegreeLabel = new JLabel(); hyphaUtilizationLabel = new JLabel(); biomassUtilizationLabel = new JLabel(); capacityUtilizationLabel = new JLabel(); labelPane.add(new JLabel("state")); labelPane.add(stateLabel); labelPane.add(new JLabel("type")); labelPane.add(typeLabel); labelPane.add(new JLabel("queue")); labelPane.add(queueLengthLabel); labelPane.add(new JLabel("")); labelPane.add(new JLabel("")); labelPane.add(new JLabel("same")); labelPane.add(sameLabel); labelPane.add(new JLabel("different")); labelPane.add(differentLabel); //labelPane.add(new JLabel("immobile")); //labelPane.add(idealImmobileLabel); labelPane.add(new JLabel("")); labelPane.add(new JLabel("actual")); labelPane.add(new JLabel("ideal")); labelPane.add(new JLabel("utilization")); labelPane.add(new JLabel("hyphae")); labelPane.add(hyphaDegreeLabel); labelPane.add(idealHyphaeLabel); labelPane.add(hyphaUtilizationLabel); labelPane.add(new JLabel("biomass")); labelPane.add(biomassDegreeLabel); labelPane.add(idealBiomassLabel); labelPane.add(biomassUtilizationLabel); labelPane.add(new JLabel("capacity")); labelPane.add(degreeLabel); labelPane.add(maxCapacityLabel); labelPane.add(capacityUtilizationLabel); neighborListControl = new JList(); neighborListControl.setLayoutOrientation(JList.VERTICAL_WRAP); neighborListControl.setVisibleRowCount(-1); neighborListScroller = new JScrollPane(neighborListControl); neighborListScroller.setPreferredSize(new Dimension(250, 150)); neighborListScroller.setMinimumSize(new Dimension(250, 150)); neighborPane.add(neighborListScroller); JButton updateButton = new JButton("Refresh"); ActionListener updater = new ActionListener() { public void actionPerformed(ActionEvent e) { refreshData(); } }; updateButton.addActionListener(updater); JButton closeButton = new JButton("Close"); ActionListener closer = new ActionListener() { public void actionPerformed(ActionEvent e) { closeFrame(); } }; closeButton.addActionListener(closer); buttonPane.add(Box.createHorizontalGlue()); buttonPane.add(updateButton); buttonPane.add(Box.createRigidArea(new Dimension(5, 0))); buttonPane.add(closeButton); refreshData(); JungGraphObserver.addChangeListener(this); this.pack(); this.setVisible(true); }
From source file:logdruid.ui.table.StatRecordingEditorTable.java
/** * @wbp.parser.constructor/*w w w. j a v a2 s .c o m*/ */ @SuppressWarnings("unchecked") public StatRecordingEditorTable(JTextPane textPane) { super(new GridLayout(1, 0)); model = new MyTableModel(data, header); table = new JTable(model); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); this.theLine = textPane.getText(); this.examplePane = textPane; // Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); // Set up column sizes. initColumnSizes(table); // Fiddle with the Type column's cell editors/renderers. setUpTypeColumn(table, table.getColumnModel().getColumn(2)); // Add the scroll pane to this panel. add(scrollPane); Add(); FixValues(); }
From source file:org.jfree.chart.demo.PlotOrientationDemo.java
/** * Creates a new demo instance./*from www. j av a2s.com*/ * * @param title the frame title. */ public PlotOrientationDemo(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); XYImageAnnotation a3 = new XYImageAnnotation(5.0, 2.0, JFreeChart.INFO.getLogo()); plot.addAnnotation(a1); plot.addAnnotation(a2); plot.addAnnotation(a3); plot.setQuadrantPaint(0, new Color(230, 230, 255)); plot.setQuadrantPaint(1, new Color(230, 255, 230)); plot.setQuadrantPaint(2, new Color(255, 230, 230)); plot.setQuadrantPaint(3, new Color(255, 230, 255)); 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); }
From source file:edu.umich.eecs.tac.viewer.role.advertiser.CampaignGrpahsPanel.java
private void initialize() { setLayout(new GridLayout(1, 1)); setBackground(TACAAViewerConstants.CHART_BACKGROUND); }
From source file:TreeDemo.java
public TreeDemo() { super(new GridLayout(1, 0)); //Create the nodes. DefaultMutableTreeNode top = new DefaultMutableTreeNode("The Java Series"); createNodes(top);/* w ww .j a v a 2s. com*/ //Create a tree that allows one selection at a time. tree = new JTree(top); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); //Listen for when the selection changes. tree.addTreeSelectionListener(this); if (playWithLineStyle) { System.out.println("line style = " + lineStyle); tree.putClientProperty("JTree.lineStyle", lineStyle); } //Create the scroll pane and add the tree to it. JScrollPane treeView = new JScrollPane(tree); //Create the HTML viewing pane. htmlPane = new JEditorPane(); htmlPane.setEditable(false); initHelp(); JScrollPane htmlView = new JScrollPane(htmlPane); //Add the scroll panes to a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(treeView); splitPane.setBottomComponent(htmlView); Dimension minimumSize = new Dimension(100, 50); htmlView.setMinimumSize(minimumSize); treeView.setMinimumSize(minimumSize); splitPane.setDividerLocation(100); //XXX: ignored in some releases //of Swing. bug 4101306 //workaround for bug 4101306: //treeView.setPreferredSize(new Dimension(100, 100)); splitPane.setPreferredSize(new Dimension(500, 300)); //Add the split pane to this panel. add(splitPane); }
From source file:net.nosleep.superanalyzer.analysis.views.MostPlayedAAView.java
public JPanel getPanel(HomePanel homePanel) { JPanel panel = new JPanel(new BorderLayout()); JPanel headerPanel = homePanel.createHeaderPanel(null, _analysis.tagsAreIncomplete()); panel.add(headerPanel, BorderLayout.NORTH); JPanel gridPanel = new JPanel(new GridLayout(1, 2)); gridPanel.add(_artistChartPanel);/* ww w . j ava 2 s . com*/ gridPanel.add(_albumChartPanel); panel.add(gridPanel, BorderLayout.CENTER); return panel; }