List of usage examples for java.awt BorderLayout WEST
String WEST
To view the source code for java.awt BorderLayout WEST.
Click Source Link
From source file:com.codecrate.shard.ui.view.ObjectManagerView.java
protected JComponent createControl() { JPanel view = new JPanel(new BorderLayout()); view.add(getScrollPane(), BorderLayout.CENTER); view.add(getQuickSearchPanel(), BorderLayout.NORTH); view.add(getTaskPanel(), BorderLayout.WEST); return view;// ww w .j ava 2 s . co m }
From source file:org.ecoinformatics.seek.ecogrid.CheckBoxTableCellRenderer.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { jTable = table;/* w ww . j a va2 s . co m*/ JPanel cellPanel = new JPanel(); cellPanel.setBorder(new LineBorder(Color.lightGray, 1)); cellPanel.setBackground(Color.WHITE); cellPanel.setPreferredSize( new Dimension(ServicesDisplayPanel.CELLPREFERREDWIDTH, ServicesDisplayPanel.HEIGHT)); SelectableDocumentType selectedDocumentType = null; boolean isChecked = false; boolean isEnable = true; String text = null; if (value != null && value instanceof SelectableObjectInterface) { SelectableObjectInterface selectedObj = (SelectableObjectInterface) value; text = selectedObj.getSelectableObjectLabel(); isChecked = selectedObj.getIsSelected(); isEnable = selectedObj.getEnabled(); } /* * label = (JLabel)renderer.getTableCellRendererComponent(table, text, * isSelected, hasFocus, row, column); */ JLabel label = new JLabel(text); label.setFont(new Font(FONTNAME, Font.PLAIN, FONTSIZE)); label.setPreferredSize(new Dimension(ServicesDisplayPanel.LABELPREFERWIDTH, ServicesDisplayPanel.HEIGHT)); // set a check box name String checkBoxName = "" + topRowNum + SEPERATOR + row; JCheckBox checkBox = new JCheckBox(); checkBox.setName(checkBoxName); checkBox.setBackground(Color.WHITE); checkBox.setSelected(isChecked); CheckBoxListener listener = new CheckBoxListener(); checkBox.addItemListener(listener); // checkBox.setEnabled(false); /* * if (topRowNum != DEFAUTTOPROW ) { // for sub table we need to set up * check box enable status checkBox.setEnabled(isEnable); }//if */ // add the label and checkbox to jpanel which has a border layout // manager BorderLayout layoutManager = new BorderLayout(); cellPanel.setLayout(layoutManager); cellPanel.add(label, BorderLayout.CENTER); cellPanel.add(checkBox, BorderLayout.WEST); return cellPanel; }
From source file:org.apache.jmeter.visualizers.backend.BackendListenerGui.java
/** * Create a panel with GUI components allowing the user to select a test * class.//from w w w . jav a 2s .co m * * @return a panel containing the relevant components */ private JPanel createClassnamePanel() { List<String> possibleClasses = new ArrayList<>(); try { // Find all the classes which implement the BackendListenerClient // interface. possibleClasses = ClassFinder.findClassesThatExtend(JMeterUtils.getSearchPaths(), new Class[] { BackendListenerClient.class }); // Remove the BackendListener class from the list since it only // implements the interface for error conditions. possibleClasses.remove(BackendListener.class.getName() + "$ErrorBackendListenerClient"); } catch (Exception e) { LOGGER.debug("Exception getting interfaces.", e); } JLabel label = new JLabel(JMeterUtils.getResString("backend_listener_classname")); // $NON-NLS-1$ classnameCombo = new JComboBox<>(possibleClasses.toArray(ArrayUtils.EMPTY_STRING_ARRAY)); classnameCombo.addActionListener(this); classnameCombo.setEditable(false); label.setLabelFor(classnameCombo); HorizontalPanel classNamePanel = new HorizontalPanel(); classNamePanel.add(label); classNamePanel.add(classnameCombo); queueSize = new JTextField(BackendListener.DEFAULT_QUEUE_SIZE, 5); queueSize.setName("Queue Size"); //$NON-NLS-1$ JLabel queueSizeLabel = new JLabel(JMeterUtils.getResString("backend_listener_queue_size")); // $NON-NLS-1$ queueSizeLabel.setLabelFor(queueSize); HorizontalPanel queueSizePanel = new HorizontalPanel(); queueSizePanel.add(queueSizeLabel, BorderLayout.WEST); queueSizePanel.add(queueSize); JPanel panel = new JPanel(new BorderLayout(0, 5)); panel.add(classNamePanel, BorderLayout.NORTH); panel.add(queueSizePanel, BorderLayout.CENTER); return panel; }
From source file:tvbrowser.ui.filter.dlgs.EditFilterDlg.java
public EditFilterDlg(JFrame parent, FilterList filterList, UserFilter filter) { super(parent, true); UiUtilities.registerForClosing(this); mFilterList = filterList;/*from w ww . ja va2 s . co m*/ mParent = parent; mFilter = filter; JPanel contentPane = (JPanel) getContentPane(); contentPane.setLayout(new BorderLayout(7, 7)); contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); if (filter == null) { setTitle(mLocalizer.msg("titleNew", "Create filter")); } else { setTitle(mLocalizer.msg("titleEdit", "Edit filter {0}", filter.toString())); mFilterName = filter.toString(); } JPanel northPanel = new JPanel(); northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS)); mFilterNameTF = new JTextField(new PlainDocument() { public void insertString(int offset, String str, AttributeSet a) throws BadLocationException { str = str.replaceAll("[\\p{Punct}&&[^_]]", "_"); super.insertString(offset, str, a); } }, "", 30); mFilterNameTF.getDocument().addDocumentListener(this); JPanel panel = new JPanel(new BorderLayout(7, 7)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0)); panel.add(new JLabel(mLocalizer.msg("filterName", "Filter name:")), BorderLayout.WEST); JPanel panel1 = new JPanel(new BorderLayout()); panel1.add(mFilterNameTF, BorderLayout.WEST); panel.add(panel1, BorderLayout.CENTER); northPanel.add(panel); mFilterRuleTF = new JTextField(); mFilterRuleTF.getDocument().addDocumentListener(this); mFilterRuleTF.addCaretListener(this); panel = new JPanel(new BorderLayout(7, 7)); panel1 = new JPanel(new BorderLayout()); panel.add(new JLabel(mLocalizer.msg("ruleString", "Filter rule:")), BorderLayout.WEST); JLabel exampleLb = new JLabel( mLocalizer.msg("ruleExample", "example: component1 or (component2 and not component3)")); Font f = exampleLb.getFont(); exampleLb.setFont(new Font(f.getName(), Font.ITALIC | Font.PLAIN, f.getSize())); panel1.add(exampleLb, BorderLayout.WEST); panel.add(panel1, BorderLayout.CENTER); northPanel.add(panel); northPanel.add(mFilterRuleTF); mFilterRuleErrorLb = new JLabel(); mFilterRuleErrorLb.setForeground(Color.red); panel = new JPanel(new BorderLayout(7, 7)); panel.add(mFilterRuleErrorLb, BorderLayout.WEST); mColLb = new JLabel("0"); panel.add(mColLb, BorderLayout.EAST); northPanel.add(panel); JPanel filterComponentsPanel = new JPanel(new BorderLayout(7, 7)); filterComponentsPanel.add(DefaultComponentFactory.getInstance().createSeparator( mLocalizer.msg("componentsTitle", "Available filter components:")), BorderLayout.NORTH); JPanel btnPanel = new JPanel(new BorderLayout()); panel1 = new JPanel(new GridLayout(0, 1, 0, 7)); mNewBtn = new JButton(mLocalizer.msg("newButton", "new")); mEditBtn = new JButton(Localizer.getLocalization(Localizer.I18N_EDIT)); mRemoveBtn = new JButton(Localizer.getLocalization(Localizer.I18N_DELETE)); mNewBtn.addActionListener(this); mEditBtn.addActionListener(this); mRemoveBtn.addActionListener(this); panel1.add(mNewBtn); panel1.add(mEditBtn); panel1.add(mRemoveBtn); btnPanel.add(panel1, BorderLayout.NORTH); mComponentTableModel = new FilterTableModel(); mRuleTableBox = new JTable(mComponentTableModel); mRuleTableBox.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { updateBtns(); } }); mRuleTableBox.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() >= 2) { int row = mRuleTableBox.rowAtPoint(e.getPoint()); if (mRuleTableBox.getSelectedRow() == row && mEditBtn.isEnabled()) { actionPerformed(new ActionEvent(mEditBtn, ActionEvent.ACTION_PERFORMED, mEditBtn.getActionCommand())); } } } }); mRuleTableBox.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mRuleTableBox.setShowGrid(false); mRuleTableBox.setShowVerticalLines(true); mRuleTableBox.getColumnModel().getColumn(0).setPreferredWidth(125); mRuleTableBox.getColumnModel().getColumn(1).setPreferredWidth(320); // mRuleTableBox.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); // Dispatchs the KeyEvent to the RootPane for Closing the Dialog. // Needed for Java 1.4. mRuleTableBox.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { mRuleTableBox.getRootPane().dispatchEvent(e); } } }); JPanel ruleListBoxPanel = new JPanel(new BorderLayout()); ruleListBoxPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 7, 0)); ruleListBoxPanel.add(new JScrollPane(mRuleTableBox), BorderLayout.CENTER); filterComponentsPanel.add(btnPanel, BorderLayout.EAST); filterComponentsPanel.add(ruleListBoxPanel, BorderLayout.CENTER); ButtonBarBuilder2 bottomBar = Utilities.createFilterButtonBar(); mOkBtn = new JButton(Localizer.getLocalization(Localizer.I18N_OK)); mOkBtn.addActionListener(this); getRootPane().setDefaultButton(mOkBtn); mCancelBtn = new JButton(Localizer.getLocalization(Localizer.I18N_CANCEL)); mCancelBtn.addActionListener(this); bottomBar.addButton(new JButton[] { mOkBtn, mCancelBtn }); contentPane.add(northPanel, BorderLayout.NORTH); contentPane.add(filterComponentsPanel, BorderLayout.CENTER); contentPane.add(bottomBar.getPanel(), BorderLayout.SOUTH); if (mFilter != null) { mFilterNameTF.setText(mFilter.toString()); mFilterRuleTF.setText(mFilter.getRule()); } FilterComponent[] fc = FilterComponentList.getInstance().getAvailableFilterComponents(); Arrays.sort(fc, new FilterComponent.NameComparator()); for (FilterComponent element : fc) { mComponentTableModel.addElement(element); } updateBtns(); Settings.layoutWindow("editFilterDlg", this, new Dimension(600, 300)); setVisible(true); }
From source file:fr.free.hd.servers.gui.PhonemView.java
@Override protected JComponent createControl() { final JPanel view = new JPanel(new BorderLayout()); Collection<Phonem> phonesList = phonemsDAO.getPhonems(); Map<String, Phonem> mapList = new HashMap<String, Phonem>(); for (Phonem phonem : phonesList) { mapList.put(phonem.getPhonem(), phonem); }/*from w w w. j ava 2s.c o m*/ final StatementListModel model = new StatementListModel(mapList); printCommand.setModel(model); printCommand.setFace(face); copyCommand.setModel(model); copyCommand.setFace(face); list = new JList(model); final JScrollPane sp = new JScrollPane(list); final JTextField field = new JTextField(); field.getDocument().addDocumentListener(new DocumentListener() { @Override public void changedUpdate(DocumentEvent e) { model.setString(field.getText()); } @Override public void insertUpdate(DocumentEvent e) { model.setString(field.getText()); } @Override public void removeUpdate(DocumentEvent e) { model.setString(field.getText()); } }); final PhonemListModel phonemModel = new PhonemListModel((List<Phonem>) phonesList); final JList phonemList = new JList(phonemModel); final JScrollPane spPhonemList = new JScrollPane(phonemList); phonemList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { // private int oldIndex = -1; @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { Phonem innerPhonem = (Phonem) phonemModel.getElementAt(phonemList.getSelectedIndex()); field.setText(field.getText() + innerPhonem.getPhonem()); } } }); phonemList.setCellRenderer(new PhonemListRenderer()); list.setCellRenderer(new StatementPhonemListRenderer(face)); list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); list.setLayoutOrientation(JList.HORIZONTAL_WRAP); list.setVisibleRowCount(1); view.add(spPhonemList, BorderLayout.WEST); view.add(sp, BorderLayout.CENTER); view.add(field, BorderLayout.SOUTH); field.requestFocus(); return view; }
From source file:projects.hip.exec.HrDiagram.java
/** * Main constructor.//from w w w .j a v a 2s . c o m */ public HrDiagram() { hipStars = HipUtils.loadHipCatalogue(); method = METHOD.NAIVE; fMax = 1.0; final JComboBox<METHOD> methodComboBox = new JComboBox<METHOD>(METHOD.values()); methodComboBox.setSelectedItem(method); methodComboBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { method = (METHOD) methodComboBox.getSelectedItem(); updateChart(); } }); final JSlider fSlider = GuiUtil.buildSlider(0.0, 2.0, 5, "%3.3f"); fSlider.setValue((int) Math.rint(100.0 * fMax / 2.0)); final JLabel fLabel = new JLabel(getFLabel()); // Create a change listener fot these ChangeListener cl = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { JSlider source = (JSlider) e.getSource(); if (source == fSlider) { // Compute fractional parallax error from slider position double newF = (2.0 * source.getValue() / 100.0); fMax = newF; fLabel.setText(getFLabel()); } updateChart(); } }; fSlider.addChangeListener(cl); // Add a bit of padding to space things out fSlider.setBorder(new EmptyBorder(5, 5, 5, 5)); // Present controls below the HR diagram JPanel controls = new JPanel(new GridLayout(2, 2)); controls.add(new JLabel("Distance estimation method:")); controls.add(methodComboBox); controls.add(fLabel); controls.add(fSlider); // Initialise the ChartPanel updateChart(); // Build the panel contents setLayout(new BorderLayout()); add(hrDiagPanel, BorderLayout.WEST); add(dDistPanel, BorderLayout.EAST); add(controls, BorderLayout.SOUTH); }
From source file:org.mn.z80util.testbench.MZ80TestBench.java
private void createAndShowGUI() { // See above// w w w. ja v a 2 s .c om if (!SwingUtilities.isEventDispatchThread()) { System.err.println("Attempting to construct the GUI from outside " + "of event dispatch thread! This is an error. Please check " + "your code modifications."); System.exit(1); } /* Initializes the GUI frame */ GUI = new JFrame("Mikko's Z80 Testbench - (C) Mikko Nummelin, 2009"); GUI.setLayout(new BorderLayout()); GUI.setIconImage(LogoFactory.createLogo()); GUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); leftPanel = new JPanel(); leftPanel.setLayout(new GridLayout(3, 1)); // The first processor information firstProcessorPanel = new JPanel(); firstProcessorPanel.setLayout(new GridLayout(2, 1)); firstProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 1")); firstProcessorPanel.add(new JLabel(processor1.getClass().getName())); firstProcessorStatus = new JLabel("-"); firstProcessorPanel.add(firstProcessorStatus); leftPanel.add(firstProcessorPanel); // The second processor information secondProcessorPanel = new JPanel(); secondProcessorPanel.setLayout(new GridLayout(2, 1)); secondProcessorPanel.setBorder(BorderFactory.createTitledBorder("Processor 2")); secondProcessorPanel.add(new JLabel(processor2.getClass().getName())); secondProcessorStatus = new JLabel("-"); secondProcessorPanel.add(secondProcessorStatus); leftPanel.add(secondProcessorPanel); // The progress bar panel progressBarPanel = new JPanel(); progressBarPanel.setLayout(new GridLayout(3, 1)); progressBarPanel.setBorder(BorderFactory.createTitledBorder("Progress")); progressBar = new JProgressBar(0, 0x6bf); progressBarPanel.add(progressBar); statusMessage = new JLabel("-"); progressBarPanel.add(statusMessage); executedCommand = new JLabel("-"); progressBarPanel.add(executedCommand); leftPanel.add(progressBarPanel); GUI.add(leftPanel, BorderLayout.WEST); // The action button panel actionPanel = new JPanel(); okCancelButton = new JButton("Cancel"); okCancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); actionPanel.add(okCancelButton); GUI.add(actionPanel, BorderLayout.SOUTH); // The image panel imagePanel = new JPanel(); java.net.URL imgURL = getClass().getResource("/Z80-pinout.png"); img = new ImageIcon(imgURL); imagePanel.add(new JLabel(img)); GUI.add(imagePanel, BorderLayout.EAST); GUI.pack(); GUI.setResizable(false); GUI.setVisible(true); }
From source file:org.rivalry.swingui.SortTablePanel.java
/** * @param tableModel Table model.//from w w w . j a va 2 s. co m * @param centerComponent Center component. (optional) * * @return a new bottom panel. */ private JPanel createSouthPanel(final TableModel tableModel, final JComponent centerComponent) { final int hgap = 20; final int vgap = 0; final JPanel answer = new JPanel(new BorderLayout(hgap, vgap)); final int top = 5; final int left = top; final int bottom = top; final int right = top; answer.setBorder(BorderFactory.createEmptyBorder(top, left, bottom, right)); answer.add(_rowCountUI, BorderLayout.WEST); if (centerComponent != null) { answer.add(centerComponent, BorderLayout.CENTER); } if (_createDateUI != null) { answer.add(_createDateUI, BorderLayout.EAST); } return answer; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.MainForm.java
private static void setComponentForPosition(final JPanel panel, final UIComponentPosition position, final JComponent component) { if (component != null) { final Object layoutPosition; switch (position) { case BOTTOM_PANEL: layoutPosition = BorderLayout.SOUTH; break; case LEFT_PANEL: layoutPosition = BorderLayout.WEST; break; case RIGHT_PANEL: layoutPosition = BorderLayout.EAST; break; case TOP_PANEL: layoutPosition = BorderLayout.NORTH; break; default:// w w w. j a v a2 s. c o m throw new Error("Unexpected position [" + position + ']'); } panel.add(component, layoutPosition); } }
From source file:com.eviware.soapui.support.components.BrowserComponent.java
public Component getComponent() { if (SoapUI.isJXBrowserDisabled()) { JEditorPane jxbrowserDisabledPanel = new JEditorPane(); jxbrowserDisabledPanel.setText("Browser Component disabled or not available on this platform"); panel.add(jxbrowserDisabledPanel); } else {//from w w w. j av a 2s. c o m if (browser == null) { if (addStatusBar) { statusBar = new JPanel(new BorderLayout()); statusLabel = new JLabel(); UISupport.setFixedSize(statusBar, new Dimension(20, 20)); statusBar.add(statusLabel, BorderLayout.WEST); panel.add(statusBar, BorderLayout.SOUTH); } if (!initBrowser()) return panel; configureBrowser(); browser.navigate("about:blank"); } } return panel; }