List of usage examples for java.awt GridBagLayout GridBagLayout
public GridBagLayout()
From source file:com.att.aro.ui.view.menu.datacollector.DeviceDialogOptions.java
private void setUpLayoutProperties() { contentLayout = new GridBagLayout(); labelConstraints = new GridBagConstraints(); labelConstraints.fill = GridBagConstraints.BOTH; labelConstraints.weightx = 0.3;//www.j a v a2 s .c o m labelConstraints.gridwidth = GridBagConstraints.RELATIVE; optionConstraints = new GridBagConstraints(); optionConstraints.fill = GridBagConstraints.BOTH; optionConstraints.weightx = 1.0; optionConstraints.gridwidth = GridBagConstraints.REMAINDER; }
From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java
/** * This method initializes this//from w w w.j a v a 2 s .co m * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints41 = new GridBagConstraints(); gridBagConstraints41.gridx = 0; gridBagConstraints41.gridwidth = 2; gridBagConstraints41.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints41.weighty = 0.01; gridBagConstraints41.weightx = 1.0; gridBagConstraints41.gridy = 1; GridBagConstraints gridBagConstraints3 = new GridBagConstraints(); gridBagConstraints3.gridx = 0; gridBagConstraints3.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints3.gridwidth = 2; gridBagConstraints3.weighty = 1.0; gridBagConstraints3.insets = new Insets(0, 20, 0, 0); gridBagConstraints3.gridy = 3; jLabelLicense = new JLabel(); jLabelLicense.setText("License :"); jLabelLicense.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelComponent = new JLabel(); jLabelComponent.setText("Component :"); jLabelComponent.setFont(new Font("Dialog", Font.PLAIN, 12)); jLabelBinding = new JLabel(); jLabelBinding.setText("Binding Type :"); jLabelBinding.setFont(new Font("Dialog", Font.PLAIN, 12)); this.setLayout(new GridBagLayout()); this.setSize(570, 480); this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51))); this.setLocation(new Point(0, 0)); this.add(getJScrollPaneFolder(), gridBagConstraints3); this.add(getJScrollPanePanel(), gridBagConstraints41); getJRadioButtonNotContain().setSelected(false); getJRadioButtonThird().setSelected(false); getJRadioButtonIKnow().setSelected(true); getJScrollPaneFolder().setVisible(true); }
From source file:com.sec.ose.osi.ui.dialog.setting.JPanProjectAnalysisSetting.java
/** * This method initializes this/*from w w w. j a v a2 s . c om*/ * * @return void */ private void initialize() { GridBagConstraints gridBagConstraints71 = new GridBagConstraints(); gridBagConstraints71.anchor = GridBagConstraints.NORTHWEST; gridBagConstraints71.weightx = 1.0; gridBagConstraints71.weighty = 1.0; gridBagConstraints71.insets = new Insets(0, 0, 0, 0); gridBagConstraints71.fill = GridBagConstraints.BOTH; GridBagConstraints gridBagConstraints14 = new GridBagConstraints(); gridBagConstraints14.gridx = -1; gridBagConstraints14.anchor = GridBagConstraints.NORTH; gridBagConstraints14.insets = new Insets(10, 10, 0, 10); gridBagConstraints14.gridy = -1; this.setLayout(new GridBagLayout()); this.add(getJIntMainPanel(), gridBagConstraints71); this.add(getJPanel(), gridBagConstraints14); }
From source file:org.zaproxy.zap.extension.ascan.ScanProgressDialog.java
/** * //from w ww. j av a2s. com */ private void initialize() { this.setSize(new Dimension(580, 504)); if (site != null) { this.setTitle(MessageFormat.format(Constant.messages.getString("ascan.progress.title"), site)); } JTabbedPane tabbedPane = new JTabbedPane(); JPanel tab1 = new JPanel(); tab1.setLayout(new GridBagLayout()); JPanel hostPanel = new JPanel(); hostPanel.setLayout(new GridBagLayout()); hostPanel.add(new JLabel(Constant.messages.getString("ascan.progress.label.host")), LayoutHelper.getGBC(0, 0, 1, 0.4D)); hostPanel.add(getHostSelect(), LayoutHelper.getGBC(1, 0, 1, 0.6D)); tab1.add(hostPanel, LayoutHelper.getGBC(0, 0, 3, 1.0D, 0.0D)); tab1.add(getJScrollPane(), LayoutHelper.getGBC(0, 1, 3, 1.0D, 1.0D)); tab1.add(new JLabel(), LayoutHelper.getGBC(0, 1, 1, 1.0D, 0.0D)); // spacer tab1.add(getCloseButton(), LayoutHelper.getGBC(1, 2, 1, 0.0D, 0.0D)); tab1.add(new JLabel(), LayoutHelper.getGBC(2, 1, 1, 1.0D, 0.0D)); // spacer tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.progress"), null, tab1, null, 0); this.add(tabbedPane); int mins = extension.getScannerParam().getMaxChartTimeInMins(); if (mins > 0) { // Treat zero mins as disabled JPanel tab2 = new JPanel(); tab2.setLayout(new GridBagLayout()); this.seriesTotal = new TimeSeries("TotalResponses"); // Name not shown, so no need to i18n final TimeSeriesCollection dataset = new TimeSeriesCollection(this.seriesTotal); this.series100 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.1xx")); this.series200 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.2xx")); this.series300 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.3xx")); this.series400 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.4xx")); this.series500 = new TimeSeries(Constant.messages.getString("ascan.progress.chart.5xx")); this.seriesTotal.setMaximumItemAge(mins * 60); this.series100.setMaximumItemAge(mins * 60); this.series200.setMaximumItemAge(mins * 60); this.series300.setMaximumItemAge(mins * 60); this.series400.setMaximumItemAge(mins * 60); this.series500.setMaximumItemAge(mins * 60); dataset.addSeries(series100); dataset.addSeries(series200); dataset.addSeries(series300); dataset.addSeries(series400); dataset.addSeries(series500); chart = createChart(dataset); // Set up some vaguesly sensible colours chart.getXYPlot().getRenderer(0).setSeriesPaint(0, Color.BLACK); // Totals chart.getXYPlot().getRenderer(0).setSeriesPaint(1, Color.GRAY); // 100: Info chart.getXYPlot().getRenderer(0).setSeriesPaint(2, Color.GREEN); // 200: OK chart.getXYPlot().getRenderer(0).setSeriesPaint(3, Color.BLUE); // 300: Info chart.getXYPlot().getRenderer(0).setSeriesPaint(4, Color.MAGENTA); // 400: Bad req chart.getXYPlot().getRenderer(0).setSeriesPaint(5, Color.RED); // 500: Internal error final ChartPanel chartPanel = new ChartPanel(chart); tab2.add(chartPanel, LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D)); tabbedPane.insertTab(Constant.messages.getString("ascan.progress.tab.chart"), null, tab2, null, 1); } // Stop the updating thread when the window is closed this.addWindowListener(new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { stopThread = true; } }); }
From source file:com.att.aro.ui.view.videotab.VideoTab.java
@Override public JPanel layoutDataPanel() { if (mainPanel == null) { mainPanel = new JPanel(new GridBagLayout()); mainPanel.setOpaque(false);/*from ww w . ja v a 2 s . c om*/ int section = 1; mainPanel.add(buildSummariesGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); graphPanelIndex = section++; addGraphPanel(); mainPanel.add(buildManifestsGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0)); mainPanel.add(buildRequestsGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0)); } return mainPanel; }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java
private final JPanel getMainPanel() { final JPanel mainPanel = new JPanel(new GridBagLayout()); mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); final ServerList linkedServerList = new ServerList(linkedServerListModel); linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList); linkedServerScrollPane//w ww . j av a2 s . c om .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane linkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(linkedServerScrollPane, c); final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel); unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList); unlinkedServerScrollPane .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers")); // Doesn't matter what this is set to, as long as it's the same as the // one for unlinkedServerScrollPane unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10)); final JPanel middlePanel = new JPanel(); middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS)); middlePanel.add(Box.createVerticalGlue()); final JButton linkSelectionButton = new JButton("<"); final JButton unlinkSelectionButton = new JButton(">"); linkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from unlinked to linked list final int selection = unlinkedServerList.getSelectedIndex(); if (selection < 0) { return; } final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection); unlinkedServerListModel.removeServer(server); linkedServerListModel.addServer(server); } }); unlinkSelectionButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { // Move selection from linked to unlinked list final int selection = linkedServerList.getSelectedIndex(); if (selection < 0) { return; } final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this, "You are about to unlink a server. " + "Unlinking a server will permanently remove \nall data associated with " + "this server, but the server will keep running. " + "\n\nAre you sure you wish to continue?", "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null); if (answer != JOptionPane.YES_OPTION) { return; } final Server server = linkedServerListModel.getVisibleServerAtIndex(selection); linkedServerListModel.removeServer(server); unlinkedServerListModel.addServer(server); } }); middlePanel.add(unlinkSelectionButton); middlePanel.add(Box.createVerticalStrut(10)); middlePanel.add(linkSelectionButton); middlePanel.add(Box.createVerticalGlue()); c.gridx = 1; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.0; mainPanel.add(middlePanel, c); c.gridx = 2; c.gridy = 0; c.weightx = 0.5; c.weighty = 1.0; mainPanel.add(unlinkedServerScrollPane, c); return mainPanel; }
From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java
private JPanel getSearchPanel(final TableRowSorter<MachineImageTableModel> sorter) { final JPanel searchPanel = new JPanel(new GridBagLayout()); searchPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20)); add(searchPanel, BorderLayout.NORTH); final PlatformComboBox platformComboBox = new PlatformComboBox(); final GridBagConstraints c = new GridBagConstraints(); c.weightx = 0.0;//w ww .j ava 2s . co m c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.insets = new Insets(0, 0, 0, 5); searchPanel.add(platformComboBox, c); final ArchitectureComboBox architectureComboBox = new ArchitectureComboBox(); c.gridx = 1; searchPanel.add(architectureComboBox, c); final BetterTextField searchField = new BetterTextField(); searchField.setPlaceHolder("Search terms"); searchField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); c.gridx = 2; c.weightx = 1.0; c.insets = new Insets(0, 0, 0, 0); searchPanel.add(searchField, c); searchField.addActionListener( new SearchFieldListener(architectureComboBox, sorter, platformComboBox, searchField)); return searchPanel; }
From source file:TextSamplerDemo.java
public TextSamplerDemo() { setLayout(new BorderLayout()); //Create a regular text field. JTextField textField = new JTextField(10); textField.setActionCommand(textFieldString); textField.addActionListener(this); //Create a password field. JPasswordField passwordField = new JPasswordField(10); passwordField.setActionCommand(passwordFieldString); passwordField.addActionListener(this); //Create a formatted text field. JFormattedTextField ftf = new JFormattedTextField(java.util.Calendar.getInstance().getTime()); ftf.setActionCommand(textFieldString); ftf.addActionListener(this); //Create some labels for the fields. JLabel textFieldLabel = new JLabel(textFieldString + ": "); textFieldLabel.setLabelFor(textField); JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": "); passwordFieldLabel.setLabelFor(passwordField); JLabel ftfLabel = new JLabel(ftfString + ": "); ftfLabel.setLabelFor(ftf);//from w w w .j ava 2 s .c o m //Create a label to put messages during an action event. actionLabel = new JLabel("Type text and then Enter in a field."); actionLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); //Lay out the text controls and the labels. JPanel textControlsPane = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); textControlsPane.setLayout(gridbag); JLabel[] labels = { textFieldLabel, passwordFieldLabel, ftfLabel }; JTextField[] textFields = { textField, passwordField, ftf }; addLabelTextRows(labels, textFields, gridbag, textControlsPane); c.gridwidth = GridBagConstraints.REMAINDER; //last c.anchor = GridBagConstraints.WEST; c.weightx = 1.0; textControlsPane.add(actionLabel, c); textControlsPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Text Fields"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Create a text area. JTextArea textArea = new JTextArea("This is an editable JTextArea. " + "A text area is a \"plain\" text component, " + "which means that although it can display text " + "in any font, all of the text is in the same font."); textArea.setFont(new Font("Serif", Font.ITALIC, 16)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(250, 250)); areaScrollPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plain Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), areaScrollPane.getBorder())); //Create an editor pane. JEditorPane editorPane = createEditorPane(); JScrollPane editorScrollPane = new JScrollPane(editorPane); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(250, 145)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); //Create a text pane. JTextPane textPane = createTextPane(); JScrollPane paneScrollPane = new JScrollPane(textPane); paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); paneScrollPane.setPreferredSize(new Dimension(250, 155)); paneScrollPane.setMinimumSize(new Dimension(10, 10)); //Put the editor pane and the text pane in a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editorScrollPane, paneScrollPane); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); JPanel rightPane = new JPanel(new GridLayout(1, 0)); rightPane.add(splitPane); rightPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Styled Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Put everything together. JPanel leftPane = new JPanel(new BorderLayout()); leftPane.add(textControlsPane, BorderLayout.PAGE_START); leftPane.add(areaScrollPane, BorderLayout.CENTER); add(leftPane, BorderLayout.LINE_START); add(rightPane, BorderLayout.LINE_END); }
From source file:coolmap.canvas.datarenderer.renderer.impl.NumberComposite.java
public NumberComposite() { setName("Number to Composite"); // System.out.println("Created a new NumberComposite"); setDescription("A renderer that can be used to assign renderers to different aggregations"); configUI.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0;// w w w . ja va 2 s . c o m c.gridy = 0; c.ipadx = 5; c.ipady = 5; c.insets = new Insets(2, 2, 2, 2); c.gridwidth = 1; //This combo box will need to be able to add registered singleComboBox = new JComboBox(); rowComboBox = new JComboBox(); columnComboBox = new JComboBox(); rowColumnComboBox = new JComboBox(); singleLegend = new JLabel(); rowLegend = new JLabel(); columnLegend = new JLabel(); rowColumnLegend = new JLabel(); singleLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); rowLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); columnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); rowColumnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); //Add them JLabel label = new JLabel("Default:"); label.setToolTipText("Default renderer"); c.gridx = 0; c.gridy++; configUI.add(label, c); c.gridx = 1; configUI.add(singleComboBox, c); singleComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 2; JButton config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (singleRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), singleRenderer.getConfigUI(), "Default Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(singleLegend, c); ////////////////////////////////////////////////////////////// c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Row Group:"); label.setToolTipText("Renderer for row ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(rowComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (rowGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), rowGroupRenderer.getConfigUI(), "Row Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); rowComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(rowLegend, c); c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Column Group:"); label.setToolTipText("Renderer for column ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(columnComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (columnGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), columnGroupRenderer.getConfigUI(), "Column Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(columnLegend, c); columnComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 0; c.gridy++; c.gridwidth = 1; label = new JLabel("Row & Column Group:"); label.setToolTipText("Renderer for row and column ontology nodes"); configUI.add(label, c); c.gridx = 1; configUI.add(rowColumnComboBox, c); c.gridx++; config = new JButton(UI.getImageIcon("gear")); configUI.add(config, c); config.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (rowColumnGroupRenderer == null) { return; } // JOptionPane.showmess int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(), rowColumnGroupRenderer.getConfigUI(), "Row + Column Group Renderer Config", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null); if (returnVal == JOptionPane.OK_OPTION) { updateRenderer(); } } }); rowColumnComboBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { updateRenderer(); } } }); c.gridx = 1; c.gridy++; c.gridwidth = 1; configUI.add(rowColumnLegend, c); JButton button = new JButton("Apply Changes", UI.getImageIcon("refresh")); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateRenderer(); } }); c.gridx = 0; c.gridy++; c.gridwidth = 2; configUI.add(button, c); singleComboBox.setRenderer(new ComboRenderer()); rowComboBox.setRenderer(new ComboRenderer()); columnComboBox.setRenderer(new ComboRenderer()); rowColumnComboBox.setRenderer(new ComboRenderer()); _updateLists(); }
From source file:fr.eurecom.hybris.demogui.HybrisDemoGui.java
private void initializeGUI() { frame = new JFrame("Hybris Demo GUI"); frame.setIconImage(new ImageIcon(getClass().getResource("/clouds.png")).getImage()); frame.setBounds(100, 100, 650, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new GridBagLayout()); JPanel cloudParentPanel = new JPanel(new GridLayout(1, 2, 10, 10)); JPanel hybrisPanel = new JPanel(new GridBagLayout()); JPanel cloudsPanel = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0;/*w ww.j a v a 2 s.c o m*/ gbc.weighty = 1.0; gbc.insets = new Insets(5, 5, 5, 5); gbc.anchor = GridBagConstraints.NORTH; gbc.fill = GridBagConstraints.BOTH; gbc.gridwidth = 3; gbc.gridheight = 1; gbc.gridx = 0; gbc.gridy = 0; hybrisPanel.add(new JLabel("<html><b>Hybris</b></html>"), gbc); gbc.gridwidth = 3; gbc.gridheight = 3; gbc.gridx = 0; gbc.gridy = 1; lstHybris = new JList<String>(lmHybris); lstHybris.setPreferredSize(new java.awt.Dimension(100, 500)); lstHybris.setMinimumSize(new java.awt.Dimension(100, 440)); hybrisPanel.add(lstHybris, gbc); gbc.anchor = GridBagConstraints.SOUTH; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridwidth = 1; gbc.gridx = 0; gbc.gridy = 4; btnPut = new JButton("Put"); hybrisPanel.add(btnPut, gbc); gbc.gridx = 1; gbc.gridy = 4; btnGet = new JButton("Get"); hybrisPanel.add(btnGet, gbc); gbc.gridx = 2; gbc.gridy = 4; btnDelete = new JButton("Delete"); hybrisPanel.add(btnDelete, gbc); gbc.fill = GridBagConstraints.BOTH; gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; cloudsPanel.add(new JLabel("<html><b>Amazon S3</b></html>"), gbc); gbc.gridheight = 2; gbc.gridy = 1; lstAmazon = new JList<String>(lmAmazon); lstAmazon.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lstAmazon.setPreferredSize(new java.awt.Dimension(100, 100)); cloudsPanel.add(lstAmazon, gbc); gbc.gridy = 3; gbc.gridheight = 1; cloudsPanel.add(new JLabel("<html><b>Microsoft Azure</b></html>"), gbc); gbc.gridheight = 2; gbc.gridy = 4; lstAzure = new JList<String>(lmAzure); lstAzure.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lstAzure.setPreferredSize(new java.awt.Dimension(100, 100)); cloudsPanel.add(lstAzure, gbc); gbc.gridy = 6; gbc.gridheight = 1; cloudsPanel.add(new JLabel("<html><b>Google Cloud Storage</b></html>"), gbc); gbc.gridheight = 2; gbc.gridy = 7; lstGoogle = new JList<String>(lmGoogle); lstGoogle.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lstGoogle.setPreferredSize(new java.awt.Dimension(100, 100)); cloudsPanel.add(lstGoogle, gbc); gbc.gridy = 9; gbc.gridheight = 1; cloudsPanel.add(new JLabel("<html><b>Rackspace Cloud Files</b></html>"), gbc); gbc.gridheight = 2; gbc.gridy = 10; lstRackspace = new JList<String>(lmRackspace); lstRackspace.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); lstRackspace.setPreferredSize(new java.awt.Dimension(100, 100)); cloudsPanel.add(lstRackspace, gbc); cloudParentPanel.add(hybrisPanel); cloudParentPanel.add(cloudsPanel); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 1; gbc.gridheight = 1; frame.add(cloudParentPanel, gbc); gbc.gridx = 0; gbc.gridy = 1; JTextArea jt = new JTextArea(10, 30); JScrollPane scrollPane = new JScrollPane(jt); frame.add(scrollPane, gbc); PrintStream printStream = new PrintStream(new CustomOutputStream(jt)); System.setOut(printStream); System.setErr(printStream); frame.pack(); frame.setSize(550, 800); frame.setResizable(false); lstAmazon.addKeyListener(this); lstAzure.addKeyListener(this); lstGoogle.addKeyListener(this); lstRackspace.addKeyListener(this); lstHybris.addKeyListener(this); lstAmazon.setCellRenderer(this.new MyListRenderer("amazon")); lstGoogle.setCellRenderer(this.new MyListRenderer("google")); lstAzure.setCellRenderer(this.new MyListRenderer("azure")); lstRackspace.setCellRenderer(this.new MyListRenderer("rackspace")); btnGet.addActionListener(this); btnPut.addActionListener(this); btnDelete.addActionListener(this); }