List of usage examples for java.awt BorderLayout PAGE_START
String PAGE_START
To view the source code for java.awt BorderLayout PAGE_START.
Click Source Link
From source file:com.xilinx.kintex7.MainScreen.java
private JPanel testAndStats() { JPanel tstats = new JPanel(); tstats.setLayout(new BoxLayout(tstats, BoxLayout.Y_AXIS)); JPanel ledPanel = new JPanel(new BorderLayout()); JPanel iledPanel = new JPanel(); iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS)); led_ddr3 = new JLabel("DDR3", new ImageIcon(led1), JLabel.CENTER); led_phy0 = new JLabel("10G PHY-0", new ImageIcon(led1), JLabel.CENTER); led_phy1 = new JLabel("10G PHY-1", new ImageIcon(led1), JLabel.CENTER); JPanel le1 = new JPanel(new BorderLayout()); le1.add(led_ddr3, BorderLayout.CENTER); JPanel le2 = new JPanel(new BorderLayout()); le2.add(led_phy0, BorderLayout.CENTER); JPanel le3 = new JPanel(new BorderLayout()); le3.add(led_phy1, BorderLayout.CENTER); iledPanel.add(le1);/*from w w w . ja va 2 s.c om*/ iledPanel.add(le2); iledPanel.add(le3); ledPanel.add(iledPanel, BorderLayout.CENTER); tstats.add(ledPanel); JPanel tstats1 = new JPanel(); tstats1.setLayout(new BoxLayout(tstats1, BoxLayout.Y_AXIS)); tstats1.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""), BorderFactory.createRaisedBevelBorder())); tstats1.add(testPanelItems()); JPanel dmaInner = new JPanel(new BorderLayout()); JPanel dmaPanel = new JPanel(new BorderLayout()); dmaPanel.setBackground(new Color(130, 170, 180)); table1 = new MyTableModel(dummy_data, dmaColumnNames0); dmaStats1 = new JTable(table1); try { dmaStats1.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader dmaHeader = dmaStats1.getTableHeader(); dmaHeader.setForeground(new Color(92, 25, 25)); dmaPanel.add(dmaHeader, BorderLayout.PAGE_START); dmaPanel.add(dmaStats1, BorderLayout.CENTER); dmaInner.add(dmaPanel, BorderLayout.CENTER); tstats1.add(dmaInner); tstats.add(tstats1); JPanel trnPanel = new JPanel(new GridLayout(1, 1)); trnPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Statistics"), BorderFactory.createRaisedBevelBorder())); JPanel trn1 = new JPanel(new FlowLayout()); trn1.add(new JLabel("Transmit (writes in Gbps): ")); trnLTX = new JTextField("0.0", 5); trnLTX.setEditable(false); trn1.add(trnLTX); trn1.add(new JLabel("Receive (reads in Gbps): ")); trnLRX = new JTextField("0.0", 5); trnLRX.setEditable(false); trn1.add(trnLRX); trnPanel.add(trn1); tstats.add(trnPanel); JPanel tstats2 = new JPanel(); tstats2.setLayout(new BoxLayout(tstats2, BoxLayout.Y_AXIS)); tstats2.add(testPanelItems1()); tstats2.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(""), BorderFactory.createRaisedBevelBorder())); JPanel dmaPanel1 = new JPanel(new BorderLayout()); table2 = new MyTableModel(dummy_data, dmaColumnNames1); dmaStats2 = new JTable(table2); try { dmaStats2.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader dmaHeader1 = dmaStats2.getTableHeader(); dmaHeader1.setForeground(new Color(92, 25, 25)); dmaPanel1.add(dmaHeader1, BorderLayout.PAGE_START); dmaPanel1.add(dmaStats2, BorderLayout.CENTER); tstats2.add(dmaPanel1); tstats.add(tstats2); JPanel tstats3 = new JPanel(new BorderLayout()); tstats3.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Message Log"), BorderFactory.createRaisedBevelBorder())); textArea = new CustomTextPane(); final JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); // keep scrollbar at end showing latest messages scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() { BoundedRangeModel brm = scrollPane.getVerticalScrollBar().getModel(); boolean wasAtBottom = true; @Override public void adjustmentValueChanged(AdjustmentEvent ae) { if (!brm.getValueIsAdjusting()) { if (wasAtBottom) brm.setValue(brm.getMaximum()); } else wasAtBottom = ((brm.getValue() + brm.getExtent()) == brm.getMaximum()); } }); textArea.setEditable(false); tstats3.add(scrollPane, BorderLayout.CENTER); tstats.add(tstats3); return tstats; }
From source file:org.broad.igv.hic.MainWindow.java
private void initComponents() { JPanel mainPanel = new JPanel(); JPanel toolbarPanel = new JPanel(); //======== this ======== Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); mainPanel.setLayout(new BorderLayout()); toolbarPanel.setBorder(null);/*from ww w.j a v a2 s. com*/ toolbarPanel.setLayout(new GridLayout()); JPanel chrSelectionPanel = new JPanel(); chrSelectionPanel.setBorder(LineBorder.createGrayLineBorder()); chrSelectionPanel.setMinimumSize(new Dimension(130, 57)); chrSelectionPanel.setPreferredSize(new Dimension(130, 57)); chrSelectionPanel.setLayout(new BorderLayout()); JPanel panel10 = new JPanel(); panel10.setBackground(new Color(204, 204, 204)); panel10.setLayout(new BorderLayout()); JLabel label3 = new JLabel(); label3.setText("Chromosomes"); label3.setHorizontalAlignment(SwingConstants.CENTER); panel10.add(label3, BorderLayout.CENTER); chrSelectionPanel.add(panel10, BorderLayout.PAGE_START); JPanel panel9 = new JPanel(); panel9.setBackground(new Color(238, 238, 238)); panel9.setLayout(new BoxLayout(panel9, BoxLayout.X_AXIS)); //---- chrBox1 ---- chrBox1 = new JComboBox(); chrBox1.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox1ActionPerformed(e); } }); panel9.add(chrBox1); //---- chrBox2 ---- chrBox2 = new JComboBox(); chrBox2.setModel(new DefaultComboBoxModel(new String[] { "All" })); chrBox2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { chrBox2ActionPerformed(e); } }); panel9.add(chrBox2); //---- refreshButton ---- JideButton refreshButton = new JideButton(); refreshButton .setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Refresh24.gif"))); refreshButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refreshButtonActionPerformed(e); } }); panel9.add(refreshButton); chrSelectionPanel.add(panel9, BorderLayout.CENTER); toolbarPanel.add(chrSelectionPanel); //======== displayOptionPanel ======== JPanel displayOptionPanel = new JPanel(); JPanel panel1 = new JPanel(); displayOptionComboBox = new JComboBox(); displayOptionPanel.setBackground(new Color(238, 238, 238)); displayOptionPanel.setBorder(LineBorder.createGrayLineBorder()); displayOptionPanel.setLayout(new BorderLayout()); //======== panel14 ======== JPanel panel14 = new JPanel(); panel14.setBackground(new Color(204, 204, 204)); panel14.setLayout(new BorderLayout()); //---- label4 ---- JLabel label4 = new JLabel(); label4.setText("Show"); label4.setHorizontalAlignment(SwingConstants.CENTER); panel14.add(label4, BorderLayout.CENTER); displayOptionPanel.add(panel14, BorderLayout.PAGE_START); //======== panel1 ======== panel1.setBorder(new EmptyBorder(0, 10, 0, 10)); panel1.setLayout(new GridLayout(1, 0, 20, 0)); //---- comboBox1 ---- displayOptionComboBox .setModel(new DefaultComboBoxModel(new String[] { DisplayOption.OBSERVED.toString() })); displayOptionComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { displayOptionComboBoxActionPerformed(e); } }); panel1.add(displayOptionComboBox); displayOptionPanel.add(panel1, BorderLayout.CENTER); toolbarPanel.add(displayOptionPanel); //======== colorRangePanel ======== JPanel colorRangePanel = new JPanel(); JLabel colorRangeLabel = new JLabel(); colorRangeSlider = new RangeSlider(); colorRangePanel.setBorder(LineBorder.createGrayLineBorder()); colorRangePanel.setMinimumSize(new Dimension(96, 70)); colorRangePanel.setPreferredSize(new Dimension(202, 70)); colorRangePanel.setMaximumSize(new Dimension(32769, 70)); colorRangePanel.setLayout(new BorderLayout()); //======== panel11 ======== JPanel colorLabelPanel = new JPanel(); colorLabelPanel.setBackground(new Color(204, 204, 204)); colorLabelPanel.setLayout(new BorderLayout()); //---- colorRangeLabel ---- colorRangeLabel.setText("Color Range"); colorRangeLabel.setHorizontalAlignment(SwingConstants.CENTER); colorRangeLabel.setToolTipText("Range of color scale in counts per mega-base squared."); colorRangeLabel.setHorizontalTextPosition(SwingConstants.CENTER); colorRangeLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } } @Override public void mouseClicked(MouseEvent e) { ColorRangeDialog rangeDialog = new ColorRangeDialog(MainWindow.this, colorRangeSlider); rangeDialog.setVisible(true); } }); colorLabelPanel.add(colorRangeLabel, BorderLayout.CENTER); colorRangePanel.add(colorLabelPanel, BorderLayout.PAGE_START); //---- colorRangeSlider ---- colorRangeSlider.setPaintTicks(true); colorRangeSlider.setPaintLabels(true); colorRangeSlider.setLowerValue(0); colorRangeSlider.setMajorTickSpacing(500); colorRangeSlider.setMaximumSize(new Dimension(32767, 52)); colorRangeSlider.setPreferredSize(new Dimension(200, 52)); colorRangeSlider.setMinimumSize(new Dimension(36, 52)); colorRangeSlider.setMaximum(2000); colorRangeSlider.setUpperValue(500); colorRangeSlider.setMinorTickSpacing(100); colorRangeSlider.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { colorRangeSliderStateChanged(e); } }); colorRangePanel.add(colorRangeSlider, BorderLayout.PAGE_END); // JPanel colorRangeTextPanel = new JPanel(); // colorRangeTextPanel.setLayout(new FlowLayout()); // JTextField minField = new JTextField(); // minField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(minField); // colorRangeTextPanel.add(new JLabel(" - ")); // JTextField maxField = new JTextField(); // maxField.setPreferredSize(new Dimension(50, 15)); // colorRangeTextPanel.add(maxField); // colorRangeTextPanel.setPreferredSize(new Dimension(200, 52)); // colorRangePanel.add(colorRangeTextPanel, BorderLayout.PAGE_END); toolbarPanel.add(colorRangePanel); //======== resolutionPanel ======== JLabel resolutionLabel = new JLabel(); JPanel resolutionPanel = new JPanel(); resolutionPanel.setBorder(LineBorder.createGrayLineBorder()); resolutionPanel.setLayout(new BorderLayout()); //======== panel12 ======== JPanel panel12 = new JPanel(); panel12.setBackground(new Color(204, 204, 204)); panel12.setLayout(new BorderLayout()); //---- resolutionLabel ---- resolutionLabel.setText("Resolution"); resolutionLabel.setHorizontalAlignment(SwingConstants.CENTER); resolutionLabel.setBackground(new Color(204, 204, 204)); panel12.add(resolutionLabel, BorderLayout.CENTER); resolutionPanel.add(panel12, BorderLayout.PAGE_START); //======== panel2 ======== JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //---- resolutionSlider ---- resolutionSlider = new JSlider(); resolutionSlider.setMaximum(8); resolutionSlider.setMajorTickSpacing(1); resolutionSlider.setPaintTicks(true); resolutionSlider.setSnapToTicks(true); resolutionSlider.setPaintLabels(true); resolutionSlider.setMinorTickSpacing(1); Dictionary<Integer, JLabel> resolutionLabels = new Hashtable<Integer, JLabel>(); Font f = FontManager.getFont(8); for (int i = 0; i < HiCGlobals.zoomLabels.length; i++) { if ((i + 1) % 2 == 0) { final JLabel tickLabel = new JLabel(HiCGlobals.zoomLabels[i]); tickLabel.setFont(f); resolutionLabels.put(i, tickLabel); } } resolutionSlider.setLabelTable(resolutionLabels); // Setting the zoom should always be done by calling resolutionSlider.setValue() so work isn't done twice. resolutionSlider.addChangeListener(new ChangeListener() { // Change zoom level while staying centered on current location. // Centering is relative to the bounds of the data, which might not be the bounds of the window public void stateChanged(ChangeEvent e) { if (!resolutionSlider.getValueIsAdjusting()) { int idx = resolutionSlider.getValue(); idx = Math.max(0, Math.min(idx, MAX_ZOOM)); if (hic.zd != null && idx == hic.zd.getZoom()) { // Nothing to do return; } if (hic.xContext != null) { int centerLocationX = (int) hic.xContext .getChromosomePosition(getHeatmapPanel().getWidth() / 2); int centerLocationY = (int) hic.yContext .getChromosomePosition(getHeatmapPanel().getHeight() / 2); hic.setZoom(idx, centerLocationX, centerLocationY, false); } //zoomInButton.setEnabled(newZoom < MAX_ZOOM); //zoomOutButton.setEnabled(newZoom > 0); } } }); panel2.add(resolutionSlider); resolutionPanel.add(panel2, BorderLayout.CENTER); toolbarPanel.add(resolutionPanel); mainPanel.add(toolbarPanel, BorderLayout.NORTH); //======== hiCPanel ======== final JPanel hiCPanel = new JPanel(); hiCPanel.setLayout(new HiCLayout()); //---- rulerPanel2 ---- rulerPanel2 = new HiCRulerPanel(hic); rulerPanel2.setMaximumSize(new Dimension(4000, 50)); rulerPanel2.setMinimumSize(new Dimension(1, 50)); rulerPanel2.setPreferredSize(new Dimension(1, 50)); rulerPanel2.setBorder(null); JPanel panel2_5 = new JPanel(); panel2_5.setLayout(new BorderLayout()); panel2_5.add(rulerPanel2, BorderLayout.SOUTH); trackPanel = new TrackPanel(hic); trackPanel.setMaximumSize(new Dimension(4000, 50)); trackPanel.setPreferredSize(new Dimension(1, 50)); trackPanel.setMinimumSize(new Dimension(1, 50)); trackPanel.setBorder(null); // trackPanelScrollpane = new JScrollPane(); // trackPanelScrollpane.getViewport().add(trackPanel); // trackPanelScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // trackPanelScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); // trackPanelScrollpane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102))); // trackPanelScrollpane.setBackground(new java.awt.Color(237, 237, 237)); // trackPanelScrollpane.setVisible(false); // panel2_5.add(trackPanelScrollpane, BorderLayout.NORTH); // trackPanel.setVisible(false); panel2_5.add(trackPanel, BorderLayout.NORTH); hiCPanel.add(panel2_5, BorderLayout.NORTH); //---- rulerPanel1 ---- rulerPanel1 = new HiCRulerPanel(hic); rulerPanel1.setMaximumSize(new Dimension(50, 4000)); rulerPanel1.setPreferredSize(new Dimension(50, 500)); rulerPanel1.setBorder(null); rulerPanel1.setMinimumSize(new Dimension(50, 1)); hiCPanel.add(rulerPanel1, BorderLayout.WEST); //---- heatmapPanel ---- heatmapPanel = new HeatmapPanel(this, hic); heatmapPanel.setBorder(LineBorder.createBlackLineBorder()); heatmapPanel.setMaximumSize(new Dimension(500, 500)); heatmapPanel.setMinimumSize(new Dimension(500, 500)); heatmapPanel.setPreferredSize(new Dimension(500, 500)); heatmapPanel.setBackground(new Color(238, 238, 238)); hiCPanel.add(heatmapPanel, BorderLayout.CENTER); //======== panel8 ======== JPanel rightSidePanel = new JPanel(); rightSidePanel.setMaximumSize(new Dimension(120, 100)); rightSidePanel.setBorder(new EmptyBorder(0, 10, 0, 0)); rightSidePanel.setLayout(null); //---- thumbnailPanel ---- thumbnailPanel = new ThumbnailPanel(this, hic); thumbnailPanel.setMaximumSize(new Dimension(100, 100)); thumbnailPanel.setMinimumSize(new Dimension(100, 100)); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBorder(LineBorder.createBlackLineBorder()); thumbnailPanel.setPreferredSize(new Dimension(100, 100)); thumbnailPanel.setBounds(new Rectangle(new Point(20, 0), thumbnailPanel.getPreferredSize())); rightSidePanel.add(thumbnailPanel); //======== xPlotPanel ======== xPlotPanel = new JPanel(); xPlotPanel.setPreferredSize(new Dimension(250, 100)); xPlotPanel.setLayout(null); rightSidePanel.add(xPlotPanel); xPlotPanel.setBounds(10, 100, xPlotPanel.getPreferredSize().width, 228); //======== yPlotPanel ======== yPlotPanel = new JPanel(); yPlotPanel.setPreferredSize(new Dimension(250, 100)); yPlotPanel.setLayout(null); rightSidePanel.add(yPlotPanel); yPlotPanel.setBounds(10, 328, yPlotPanel.getPreferredSize().width, 228); // compute preferred size Dimension preferredSize = new Dimension(); for (int i = 0; i < rightSidePanel.getComponentCount(); i++) { Rectangle bounds = rightSidePanel.getComponent(i).getBounds(); preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width); preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height); } Insets insets = rightSidePanel.getInsets(); preferredSize.width += insets.right; preferredSize.height += insets.bottom; rightSidePanel.setMinimumSize(preferredSize); rightSidePanel.setPreferredSize(preferredSize); hiCPanel.add(rightSidePanel, BorderLayout.EAST); mainPanel.add(hiCPanel, BorderLayout.CENTER); contentPane.add(mainPanel, BorderLayout.CENTER); JMenuBar menuBar = createMenuBar(hiCPanel); contentPane.add(menuBar, BorderLayout.NORTH); // setup the glass pane to display a wait cursor when visible, and to grab all mouse events rootPane.getGlassPane().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); rootPane.getGlassPane().addMouseListener(new MouseAdapter() { }); }
From source file:com.pironet.tda.TDA.java
private void setShowToolbar(boolean state) { if (state) {/*from w w w . j a v a 2s . com*/ add(getMainMenu().getToolBar(), BorderLayout.PAGE_START); } else { remove(getMainMenu().getToolBar()); } revalidate(); PrefManager.get().setShowToolbar(state); }
From source file:org.domainmath.gui.MainFrame.java
private void histPanel() { JPanel p = new JPanel(new BorderLayout()); JToolBar b = new JToolBar(""); b.setFloatable(false);//from w w w. ja v a 2 s . co m b.setRollover(true); JButton saveButton = new JButton(); JButton runButton = new JButton(); saveButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/script_save.png"))); runButton.setIcon( new javax.swing.ImageIcon(getClass().getResource("/org/domainmath/gui/icons/terminal.png"))); b.add(saveButton); b.add(runButton); p.add(b, BorderLayout.PAGE_START); p.add(this.histScrollPane, BorderLayout.CENTER); saveButton.addActionListener((ActionEvent e) -> { saveHistoryAs(); }); runButton.addActionListener((ActionEvent e) -> { runHistory(); }); historyView = new View("History", null, p); }
From source file:nl.detoren.ijsco.ui.Mainscreen.java
public JPanel createPanelScenariosHolder() { JPanel panel = new JPanel(); panel.setBackground(Color.RED); panel.setLayout(new BorderLayout(0, 0)); panel.add(createPanelScenariosButtons(), BorderLayout.PAGE_START); panel.add(createPanelScenarios(), BorderLayout.CENTER); return panel; }
From source file:com.xilinx.virtex7.MainScreen.java
private Container createContentPane() { JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); contentPane.setOpaque(true);/* w ww. j av a2 s .com*/ mainPanel = new JPanel(new BorderLayout()); mainPanel.setBounds(0, 0, minWidth, minHeight); testPanel = new JPanel(new BorderLayout()); ttabs = new JTabbedPane(); ttabs.add("DATAPATH 0&1", testAndStats()); if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV || mode == LandingPage.APPLICATION_MODE || mode == LandingPage.APPLICATION_MODE_P2P) // condition for placing dynamic tabs. a kcah ttabs.add("DATAPATH 2&3", testAndStatsSecondTab()); else testAndStatsSecondTab(); testPanel.add(ttabs, BorderLayout.CENTER); testPanel.add(messageBox(), BorderLayout.PAGE_END); mainPanel.add(testPanel, BorderLayout.LINE_START); //Make the center component big, since that's the //typical usage of BorderLayout. tabs = new JTabbedPane(); mainPanel.add(tabs, BorderLayout.CENTER); tabs.add("System Monitor", pciInfo()); tabs.add("Performance Plots", plotPanel()); mainPanel.setOpaque(true); try { imagePanel = new ImageBackgroundPanel(blockDiagram, false); } catch (Exception e) { } /*imagePanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Design Block Diagram"), BorderFactory.createEmptyBorder(5,5,5,5)));*/ imagePanel.setBackground(Color.WHITE); imagePanel.setSize(minWidth, minHeight); imagePanel.setLocation(0, 0); imagePanel.setOpaque(true); final JLayeredPane layeredPane = new JLayeredPane(); layeredPane.setPreferredSize(new Dimension(minWidth, minHeight)); layeredPane.add(mainPanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.add(imagePanel, JLayeredPane.DEFAULT_LAYER, 0); layeredPane.addComponentListener(new ComponentListener() { @Override public void componentResized(ComponentEvent ce) { mainPanel.setBounds(0, 0, Math.max(minWidth, layeredPane.getWidth()), Math.max(minHeight, layeredPane.getHeight())); if (layeredPane.getWidth() > 1024) { tplotPanel.setPreferredSize(new Dimension(300, 100)); } else { tplotPanel.setPreferredSize(new Dimension(200, 100)); } imagePanel.setSize(mainPanel.getWidth(), mainPanel.getHeight()); imagePanel.setLocation(0, 0); mainPanel.repaint(); } @Override public void componentMoved(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentShown(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } @Override public void componentHidden(ComponentEvent ce) { //throw new UnsupportedOperationException("Not supported yet."); } }); // on top, but invisible initially imagePanel.setVisible(false); JPanel bpanel = new JPanel(new BorderLayout()); final JButton button = new JButton( "<html><b>B<br>L<br>O<br>C<br>K<br> <br>D<br>I<br>A<br>G<br>R<br>A<br>M<br></b></html>"); button.setToolTipText("Click here to see the block diagram"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { adjustSelectionPanel(); } }); bpanel.add(button, BorderLayout.CENTER); contentPane.add(layeredPane, BorderLayout.CENTER); contentPane.add(button, BorderLayout.EAST); JPanel panel = new JPanel(new BorderLayout()); JLabel mLabel = new JLabel(modeText, JLabel.CENTER); mLabel.setFont(new Font(modeText, Font.BOLD, 15)); panel.add(mLabel, BorderLayout.PAGE_START); JPanel ledPanel = new JPanel(new BorderLayout()); JPanel iledPanel = new JPanel(); iledPanel.setLayout(new BoxLayout(iledPanel, BoxLayout.X_AXIS)); led_ddr3_1 = new JLabel("DDR3 0", new ImageIcon(led1), JLabel.CENTER); led_ddr3_2 = new JLabel("DDR3 1", new ImageIcon(led1), JLabel.CENTER); led_phy0 = new JLabel("PHY 0", new ImageIcon(led1), JLabel.CENTER); led_phy1 = new JLabel("PHY 1", new ImageIcon(led1), JLabel.CENTER); led_phy2 = new JLabel("PHY 2", new ImageIcon(led1), JLabel.CENTER); led_phy3 = new JLabel("PHY 3", new ImageIcon(led1), JLabel.CENTER); JPanel le1 = new JPanel(new BorderLayout()); le1.add(led_ddr3_1, BorderLayout.CENTER); JPanel le2 = new JPanel(new BorderLayout()); le2.add(led_ddr3_2, BorderLayout.CENTER); JPanel le3 = new JPanel(new BorderLayout()); le3.add(led_phy0, BorderLayout.CENTER); JPanel le4 = new JPanel(new BorderLayout()); le4.add(led_phy1, BorderLayout.CENTER); JPanel le5 = new JPanel(new BorderLayout()); le5.add(led_phy2, BorderLayout.CENTER); JPanel le6 = new JPanel(new BorderLayout()); le6.add(led_phy3, BorderLayout.CENTER); iledPanel.add(le1); iledPanel.add(le2); iledPanel.add(le3); iledPanel.add(le4); iledPanel.add(le5); iledPanel.add(le6); if (mode == LandingPage.PERFORMANCE_MODE_RAW || mode == LandingPage.PERFORMANCE_MODE_RAW_DV) { startAll_tooltip = "This will start tests on all data paths"; startAlltests = new JButton("Start All"); startAlltests.setToolTipText(startAll_tooltip); startAlltests.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (startAlltests.getText().equals("Start All")) { startAll_tooltip = "This will stop tests on all data paths"; startAlltests.setToolTipText(startAll_tooltip); // check whether any tests are already started String message = ""; if (testStarted || testStarted1) message = "Test(s) on Path 0&1 are running. Cannot do Start All"; if (testStarted2 || testStarted3) { if (message.length() > 0) // test 1 and 0 are also running message = "Test(s) on Path 0&1 and 2&3 are running. Cannot do Start All"; else message = "Test(s) on Path 2&3 are running. Cannot do Start All"; } if (message.length() > 0) { JOptionPane.showMessageDialog(null, message, "Error", JOptionPane.ERROR_MESSAGE); } else { String ledsMsg = checkLedsState(); // condition to check the ddr and py leds are enable or not if (ledsMsg.length() == 0) { startAlltests.setEnabled(false); startAlltests.setText("Stop All"); startTest.doClick(); stest.doClick(); s3test.doClick(); s4test.doClick(); // disable all buttons startTest.setEnabled(false); stest.setEnabled(false); s3test.setEnabled(false); s4test.setEnabled(false); startAlltests.setEnabled(true); } else {// shows alert when leds are disabled JOptionPane.showMessageDialog(null, ledsMsg, "Error", JOptionPane.ERROR_MESSAGE); } } } else { startAlltests.setEnabled(false); startAll_tooltip = "This will start tests on all data paths"; startAlltests.setToolTipText(startAll_tooltip); /* startTest.setEnabled(true); stest.setEnabled(true); s3test.setEnabled(true); s4test.setEnabled(true); s3test.doClick(); s4test.doClick(); startTest.doClick(); stest.doClick(); */ SwingWorker worker = new SwingWorker<Void, Void>() { @Override protected Void doInBackground() throws Exception { try { stopTest4(); s4test.setEnabled(false); stopTest3(); s3test.setEnabled(false); stopTest2(); stest.setEnabled(false); stopTest1(); startTest.setEnabled(false); startAlltests.setText("Start All"); startAlltests.setEnabled(true); startTest.setEnabled(true); stest.setEnabled(true); s3test.setEnabled(true); s4test.setEnabled(true); } catch (Exception e) { e.printStackTrace(); } return null; } }; worker.execute(); } } }); iledPanel.add(startAlltests); } ledPanel.add(iledPanel, BorderLayout.CENTER); //tstats.add(ledPanel); panel.add(ledPanel, BorderLayout.CENTER); contentPane.add(panel, BorderLayout.PAGE_START); return contentPane; }
From source file:pcgui.SetupParametersPanel.java
/** * Shows a window with execution progress and logs the percent completion *//*from ww w . j av a 2 s .co m*/ private void showProgressBar() { pbar = new JProgressBar(); pbar.setMinimum(MY_MINIMUM); pbar.setMaximum(MY_MAXIMUM); pbar.setValue(0); pbar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setMargin(new Insets(5, 5, 5, 5)); taskOutput.setEditable(false); progressFrame = new JFrame("Running test instances"); JPanel rootPanel = new JPanel(new BorderLayout()); rootPanel.setOpaque(true); progressFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); progressFrame.setContentPane(rootPanel); JPanel panel = new JPanel(); panel.add(pbar); rootPanel.add(panel, BorderLayout.PAGE_START); rootPanel.add(new JScrollPane(taskOutput), BorderLayout.CENTER); rootPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); progressFrame.pack(); // make the frame half the height and width Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int height = screenSize.height; int width = screenSize.width; progressFrame.setSize(width / 2, height / 2); // here's the part where i center the jframe on screen progressFrame.setLocationRelativeTo(null); progressFrame.setVisible(true); }
From source file:org.graphwalker.GUI.App.java
private void init() { setTitle(title);/*from w ww .j av a 2s . c om*/ setBackground(Color.gray); JPanel topPanel = new JPanel(); topPanel.setLayout(new BorderLayout()); getContentPane().add(topPanel); // Create the panels createPanelStatistics(); createPanelVariables(); createPanelGraph(); // Create a splitter panes splitPaneGraph = new JSplitPane(JSplitPane.VERTICAL_SPLIT); topPanel.add(splitPaneGraph, BorderLayout.CENTER); splitPaneGraph.setTopComponent(panelGraph); splitPaneMessages = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPaneGraph.setBottomComponent(splitPaneMessages); splitPaneMessages.setLeftComponent(panelStatistics); splitPaneMessages.setRightComponent(panelVariables); JToolBar toolBar = new JToolBar("Toolbar"); add(toolBar, BorderLayout.PAGE_START); addButtons(toolBar); statusBar = new StatusBar(); getContentPane().add(statusBar, java.awt.BorderLayout.SOUTH); int delay = 1000; // delay for 1 sec. int period = 500; // repeat every 0.5 sec. updateColorLatestVertexLabel = new Timer(); updateColorLatestVertexLabel.scheduleAtFixedRate(new TimerTask() { @Override public void run() { if (getStatus().isStopped()) { if (getLatestVertexLabel().getBackground().equals(Color.GRAY)) { return; } getLatestVertexLabel().setBackground(Color.GRAY); } if (getStatus().isPaused() && !(getStatus().isNext() || getStatus().isExecutingJavaTest())) { getLatestVertexLabel().setBackground(Color.RED); } else if (getStatus().isRunning() || getStatus().isNext() || getStatus().isExecutingJavaTest() || getStatus().isExecutingSoapTest()) { getLatestVertexLabel().setBackground(Color.GREEN); } } }, delay, period); if (xmlFile != null) loadModel(); else if (graphmlFile != null && logFile != null) { setWaitCursor(); try { mbt.readGraph(graphmlFile.getAbsolutePath()); } catch (Exception e) { Util.logStackTraceToError(e); JOptionPane.showMessageDialog(App.getInstance(), "Failed to load model. " + e.getMessage()); } try { parsedLogFile = ParseLog.readLog(logFile); currentStep = 0; } catch (IOException e) { Util.logStackTraceToError(e); JOptionPane.showMessageDialog(App.getInstance(), "Failed to load log file. " + e.getMessage()); } Integer index = parsedLogFile.get(currentStep).index; AbstractElement ae = mbt.setAsVisited(index); if (ae instanceof Edge) { mbt.getMachine().setLastEdge((Edge) ae); mbt.setCurrentVertex((Vertex) null); } status.setState(Status.executingLogTest); status.unsetState(Status.stopped); setButtons(); setDefaultCursor(); } }
From source file:com.xilinx.kintex7.MainScreen.java
private JPanel pciInfo() { JPanel pciSystemPanel = new JPanel(); pciSystemPanel.setLayout(new BoxLayout(pciSystemPanel, BoxLayout.Y_AXIS)); JPanel topPanel = new JPanel(new GridLayout(1, 2)); topPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("PCIe Settings"), BorderFactory.createRaisedBevelBorder())); JPanel sPanel = new JPanel(new FlowLayout()); sPanel.add(new JLabel("Link Speed: ")); Object[] speeds = { "2.5 Gbps", "5.0 Gbps" }; final PartialDisableComboBox lspeed = new PartialDisableComboBox(); lspeed.addItems(speeds);/* w w w .j a v a 2 s .co m*/ lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false); sPanel.add(lspeed); JButton setSpeed = new JButton("Go"); setSpeed.setToolTipText("This enables directed PCIe link speed change"); setSpeed.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (lspeed.isItemEnabled(lspeed.getSelectedIndex())) { int ret = di.setLinkSpeed(lspeed.getSelectedIndex() + 1); if (ret == 0) { //update pcie information di.get_PCIstate(); lspeed.setItemEnabled(0, true); lspeed.setItemEnabled(1, true); lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false); ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames); ptable.fireTableDataChanged(); } else { updateLog("Unable to set Link Speed " + lspeed.getSelectedItem(), keyWord); } } } }); sPanel.add(setSpeed); topPanel.add(sPanel); JPanel sPanel1 = new JPanel(new FlowLayout()); sPanel1.add(new JLabel("Link Width: ")); Object[] widths = { "x1", "x2", "x4", "x8" }; final PartialDisableComboBox lwidths = new PartialDisableComboBox(); lwidths.addItems(widths); lwidths.setSelectedItem("x" + di.getPCIInfo().LinkWidth); lwidths.setItemEnabled(lwidths.getSelectedIndex(), false); sPanel1.add(lwidths); JButton setWidth = new JButton("Go"); setWidth.setToolTipText("This enables directed PCIe link width change"); setWidth.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (lwidths.isItemEnabled(lwidths.getSelectedIndex())) { int ret = di.setLinkWidth(lwidths.getSelectedIndex() + 1); if (ret == 0) { //update pcie information // some times width change affect link speed so // enable the same in lspeedd also di.get_PCIstate(); lwidths.setItemEnabled(0, true); lwidths.setItemEnabled(1, true); lwidths.setItemEnabled(2, true); lwidths.setItemEnabled(3, true); lwidths.setSelectedItem("x" + di.getPCIInfo().LinkWidth); lwidths.setItemEnabled(lwidths.getSelectedIndex(), false); // some times width change affect link speed so // enable the same in lspeed also lspeed.setItemEnabled(0, true); lspeed.setItemEnabled(1, true); lspeed.setSelectedIndex(di.getPCIInfo().LinkSpeed - 1); lspeed.setItemEnabled(di.getPCIInfo().LinkSpeed - 1, false); ptable.setData(di.getPCIInfo().getPCIData(), pcieColumnNames); ptable.fireTableDataChanged(); } else { di.get_PCIstate(); int upCap = di.getPCIInfo().LinkUpCap; if (upCap == 0) updateLog("Unable to set Link Width " + lwidths.getSelectedItem() + ". PCIe link not upconfigurable", keyWord); else updateLog("Unable to set Link Width " + lwidths.getSelectedItem(), keyWord); } } } }); sPanel1.add(setWidth); topPanel.add(sPanel1); pciSystemPanel.add(topPanel); JPanel panel = new JPanel(new GridLayout(1, 2)); JPanel pciPanel = new JPanel(new BorderLayout()); pciPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("PCIe Endpoint Status"), BorderFactory.createRaisedBevelBorder())); ptable = new MyTableModel(di.getPCIInfo().getPCIData(), pcieColumnNames); pcieTable = new JTable(ptable); try { pcieTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader pcieHeader = pcieTable.getTableHeader(); pcieHeader.setForeground(new Color(92, 25, 25)); pciPanel.add(pcieHeader, BorderLayout.PAGE_START); pciPanel.add(pcieTable, BorderLayout.CENTER); panel.add(pciPanel); JPanel hostPanel = new JPanel(new BorderLayout()); hostPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Host System's Initial Credits"), BorderFactory.createRaisedBevelBorder())); htable = new MyTableModel(di.getPCIInfo().getHostedData(), pcieColumnNames); hostTable = new JTable(htable); try { hostTable.setDefaultRenderer(Object.class, new CustomTableCellRenderer()); } catch (Exception e) { } JTableHeader hostHeader = hostTable.getTableHeader(); hostHeader.setForeground(new Color(92, 25, 25)); hostPanel.add(hostHeader, BorderLayout.PAGE_START); hostPanel.add(hostTable, BorderLayout.CENTER); panel.add(hostPanel); pciSystemPanel.add(panel); pciSystemPanel.add(dialChart(pciSystemPanel.getWidth())); return pciSystemPanel; }
From source file:UI.SecurityDashboard.java
private void performMetric1(MainViewPanel mvp) { Metric1 metric1 = new Metric1(); JPanel graphPanel1 = new JPanel(); graphPanel1.setLayout(new BorderLayout()); graphPanel1.add(metric1.run(), BorderLayout.NORTH); DevicePanel.setLayout(new BorderLayout()); JTextArea header = new JTextArea( "\nThe Network Vulnerability test scans the entire network for all existing vulnerabilities that may " + "exist within and display the vulnerabilities (if any) for each device (computer, tablet or mobile device).\n"); //header.setLineWrap(true); //header.setWrapStyleWord(true); header.setEditable(false);/*from w w w . ja va2 s .c o m*/ header.setMaximumSize(new Dimension(DevicePanel.getWidth(), 3)); DevicePanel.add(header, BorderLayout.NORTH); DevicePanel.add(graphPanel1, BorderLayout.CENTER); ChartPanel firstPanel = mvp.getPanel1(metric1); firstPanel.addChartMouseListener(new ChartMouseListener() { @Override public void chartMouseClicked(ChartMouseEvent cme) { dashboardTabs.setSelectedIndex(1); } @Override public void chartMouseMoved(ChartMouseEvent cme) { } }); Metric1Panel.setLayout(new BorderLayout()); Font titleFont = new Font("Calibri", Font.BOLD, 27); JLabel vulnerabilitiesTitleLabel = new JLabel(" Vulnerabilities"); vulnerabilitiesTitleLabel.setFont(titleFont); Metric1Panel.add(vulnerabilitiesTitleLabel, BorderLayout.PAGE_START); Font devCountFont = new Font("Calibri", Font.BOLD, 16); String devCount = " Device Count: " + metric1.deviceCount; JLabel devCountLabel = new JLabel(devCount); devCountLabel.setFont(devCountFont); Metric1Panel.add(devCountLabel, BorderLayout.SOUTH); Metric1Panel.add(firstPanel, BorderLayout.CENTER); Metric1Panel.setBackground(Color.white); Metric1Panel.setEnabled(false); }