List of usage examples for java.awt BorderLayout LINE_END
String LINE_END
To view the source code for java.awt BorderLayout LINE_END.
Click Source Link
From source file:org.sikuli.ide.extmanager.ExtensionManagerFrame.java
void createComponents() { Container pane;//from w w w . j av a2s . c o m pane = getContentPane(); pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); try { // Populate the list of extensions _extensions = retrieveExtensions(); for (ExtensionItem ext : _extensions) { pane.add(ext); ; } // Select the first one select(0); } catch (IOException io) { String msg = "Unable to load extensions from the server: " + io.getMessage(); JTextField txt = new JTextField(msg); txt.setBackground(null); txt.setBorder(null); txt.setEditable(false); pane.add(txt); } JPanel bottomBar = new JPanel(); bottomBar.setLayout(new BorderLayout()); bottomBar.setMinimumSize(new Dimension(400, 20)); JButton closeBtn = new JButton("Close"); closeBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { dispose(); } }); closeBtn.setFocusable(false); bottomBar.add(closeBtn, BorderLayout.LINE_END); pane.add(bottomBar); }
From source file:integratedprogressdemo.WeatherData.java
private WeatherData(boolean displayProgress) { setBackground(Color.WHITE);//from ww w.j a v a 2s.co m setLayout(new BorderLayout()); JLabel lbl = new JLabel("World-Wide Weather Data"); lbl.setFont(new Font("Serif", Font.PLAIN, 18)); add(lbl, BorderLayout.PAGE_START); lbl = new JLabel("Weather information from over 50 cities"); add(lbl, BorderLayout.LINE_START); if (displayProgress) { progressPanel = new JPanel(); progressPanel.setBackground(Color.WHITE); progressPanel.setLayout(new BorderLayout(20, 20)); String lblText = "<html>Stuck in the mud? Make progress with...<br /><font color=red><em>JDK Documentation</em></font><br/></html>"; lbl = new JLabel(lblText); progressPanel.add(lbl, BorderLayout.NORTH); progressBar = new JProgressBar(0, 100); progressBar.setValue(0); progressBar.setStringPainted(true); progressPanel.add(progressBar, BorderLayout.SOUTH); add(progressPanel, BorderLayout.LINE_END); } String[] columnNames = { "City", "Temperature" }; JTable table = new JTable(getData(), columnNames); table.setPreferredScrollableViewportSize(new Dimension(500, 70)); table.setFillsViewportHeight(true); //Create the scroll pane and add the table to it. JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBackground(Color.WHITE); //Add the scroll pane to this panel. add(scrollPane, BorderLayout.PAGE_END); }
From source file:DragFileDemo.java
public DragFileDemo() { super(new BorderLayout()); fc = new JFileChooser(); ;/*from ww w. j av a2 s . c om*/ fc.setMultiSelectionEnabled(true); fc.setDragEnabled(true); fc.setControlButtonsAreShown(false); JPanel fcPanel = new JPanel(new BorderLayout()); fcPanel.add(fc, BorderLayout.CENTER); clear = new JButton("Clear All"); clear.addActionListener(this); JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); buttonPanel.add(clear, BorderLayout.LINE_END); JPanel upperPanel = new JPanel(new BorderLayout()); upperPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); upperPanel.add(fcPanel, BorderLayout.CENTER); upperPanel.add(buttonPanel, BorderLayout.PAGE_END); //The TabbedPaneController manages the panel that //contains the tabbed pane. When there are no files //the panel contains a plain text area. Then, as //files are dropped onto the area, the tabbed panel //replaces the file area. JTabbedPane tabbedPane = new JTabbedPane(); JPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tpc = new TabbedPaneController(tabbedPane, tabPanel); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperPanel, tabPanel); splitPane.setDividerLocation(400); splitPane.setPreferredSize(new Dimension(530, 650)); add(splitPane, BorderLayout.CENTER); }
From source file:misc.FocusTraversalDemo.java
public FocusTraversalDemo() { super(new BorderLayout()); JTextField tf1 = new JTextField("Field 1"); JTextField tf2 = new JTextField("A Bigger Field 2"); JTextField tf3 = new JTextField("Field 3"); JTextField tf4 = new JTextField("A Bigger Field 4"); JTextField tf5 = new JTextField("Field 5"); JTextField tf6 = new JTextField("A Bigger Field 6"); JTable table = new JTable(4, 3); togglePolicy = new JCheckBox("Custom FocusTraversalPolicy"); togglePolicy.setActionCommand("toggle"); togglePolicy.addActionListener(this); togglePolicy.setFocusable(false); //Remove it from the focus cycle. //Note that HTML is allowed and will break this run of text //across two lines. label = new JLabel( "<html>Use Tab (or Shift-Tab) to navigate from component to component.<p>Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>"); JPanel leftTextPanel = new JPanel(new GridLayout(3, 2)); leftTextPanel.add(tf1, BorderLayout.PAGE_START); leftTextPanel.add(tf3, BorderLayout.CENTER); leftTextPanel.add(tf5, BorderLayout.PAGE_END); leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel rightTextPanel = new JPanel(new GridLayout(3, 2)); rightTextPanel.add(tf2, BorderLayout.PAGE_START); rightTextPanel.add(tf4, BorderLayout.CENTER); rightTextPanel.add(tf6, BorderLayout.PAGE_END); rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel tablePanel = new JPanel(new GridLayout(0, 1)); tablePanel.add(table, BorderLayout.CENTER); tablePanel.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel = new JPanel(new GridLayout(2, 1)); bottomPanel.add(togglePolicy, BorderLayout.PAGE_START); bottomPanel.add(label, BorderLayout.PAGE_END); add(leftTextPanel, BorderLayout.LINE_START); add(rightTextPanel, BorderLayout.CENTER); add(tablePanel, BorderLayout.LINE_END); add(bottomPanel, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); Vector<Component> order = new Vector<Component>(7); order.add(tf1);//from w ww. j a va2 s.com order.add(tf2); order.add(tf3); order.add(tf4); order.add(tf5); order.add(tf6); order.add(table); newPolicy = new MyOwnFocusTraversalPolicy(order); }
From source file:com.microsoft.alm.plugin.idea.ui.common.tabs.TabFormImpl.java
/** * Create the tab view if not already done *//*from w w w. ja v a2 s .c o m*/ protected void ensureInitialized() { if (!initialized) { createCustomView(); createFilterToolbar(); //toolbars final JPanel toolBarPanel; if (ApplicationManager.getApplication() != null) { final ActionToolbar prActionsToolbar = createToolbar(createActionsGroup()); final ActionToolbar feedbackActionsToolbar = createToolbar(createFeedbackGroup()); // left panel of the top toolbar final FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 0, JBUI.scale(3)); // give vertical padding final JPanel toolBarPanelLeft = new JPanel(flowLayout); toolBarPanelLeft.add(prActionsToolbar.getComponent()); toolBarPanelLeft.add(searchFilter); //entire top toolbar toolBarPanel = new JPanel(new BorderLayout()); toolBarPanel.add(toolBarPanelLeft, BorderLayout.LINE_START); toolBarPanel.add(feedbackActionsToolbar.getComponent(), BorderLayout.LINE_END); } else { //skip setup when called from unit tests toolBarPanel = new JPanel(); } //status panel with label and link final JPanel statusPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); statusLabel = new JLabel(); statusLink = new Hyperlink(); statusLink.setActionCommand(CMD_STATUS_LINK); statusPanel.add(statusLabel); statusPanel.add(statusLink); //tabPanel tabPanel = new JPanel(new BorderLayout()); tabPanel.add(toolBarPanel, BorderLayout.PAGE_START); tabPanel.add(scrollPanel, BorderLayout.CENTER); tabPanel.add(statusPanel, BorderLayout.PAGE_END); this.initialized = true; } }
From source file:FocusTraversalDemo.java
public FocusTraversalDemo() { super(new BorderLayout()); JTextField tf1 = new JTextField("Field 1"); JTextField tf2 = new JTextField("A Bigger Field 2"); JTextField tf3 = new JTextField("Field 3"); JTextField tf4 = new JTextField("A Bigger Field 4"); JTextField tf5 = new JTextField("Field 5"); JTextField tf6 = new JTextField("A Bigger Field 6"); JTable table = new JTable(4, 3); togglePolicy = new JCheckBox("Custom FocusTraversalPolicy"); togglePolicy.setActionCommand("toggle"); togglePolicy.addActionListener(this); togglePolicy.setFocusable(false); // Remove it from the focus cycle. // Note that HTML is allowed and will break this run of text // across two lines. label = new JLabel( "<html>Use Tab (or Shift-Tab) to navigate from component to component.Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>"); JPanel leftTextPanel = new JPanel(new GridLayout(3, 2)); leftTextPanel.add(tf1, BorderLayout.PAGE_START); leftTextPanel.add(tf3, BorderLayout.CENTER); leftTextPanel.add(tf5, BorderLayout.PAGE_END); leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel rightTextPanel = new JPanel(new GridLayout(3, 2)); rightTextPanel.add(tf2, BorderLayout.PAGE_START); rightTextPanel.add(tf4, BorderLayout.CENTER); rightTextPanel.add(tf6, BorderLayout.PAGE_END); rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel tablePanel = new JPanel(new GridLayout(0, 1)); tablePanel.add(table, BorderLayout.CENTER); tablePanel.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel = new JPanel(new GridLayout(2, 1)); bottomPanel.add(togglePolicy, BorderLayout.PAGE_START); bottomPanel.add(label, BorderLayout.PAGE_END); add(leftTextPanel, BorderLayout.LINE_START); add(rightTextPanel, BorderLayout.CENTER); add(tablePanel, BorderLayout.LINE_END); add(bottomPanel, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); Vector<Component> order = new Vector<Component>(7); order.add(tf1);//from ww w. j ava 2s . co m order.add(tf2); order.add(tf3); order.add(tf4); order.add(tf5); order.add(tf6); order.add(table); newPolicy = new MyOwnFocusTraversalPolicy(order); }
From source file:FocusTraversalDemo.java
public FocusTraversalDemo() { super(new BorderLayout()); newPolicy = new MyOwnFocusTraversalPolicy(); tf1 = new JTextField("Field 1"); tf2 = new JTextField("A Bigger Field 2"); tf3 = new JTextField("Field 3"); tf4 = new JTextField("A Bigger Field 4"); tf5 = new JTextField("Field 5"); tf6 = new JTextField("A Bigger Field 6"); table = new JTable(4, 3); togglePolicy = new JCheckBox("Custom FocusTraversalPolicy"); togglePolicy.setActionCommand("toggle"); togglePolicy.addActionListener(this); togglePolicy.setFocusable(false); //Remove it from the focus cycle. //Note that HTML is allowed and will break this run of text //across two lines. label = new JLabel( "<html>Use Tab (or Shift-Tab) to navigate from component to component.<p>Control-Tab (or Control-Shift-Tab) allows you to break out of the JTable.</html>"); JPanel leftTextPanel = new JPanel(new GridLayout(3, 2)); leftTextPanel.add(tf1, BorderLayout.PAGE_START); leftTextPanel.add(tf3, BorderLayout.CENTER); leftTextPanel.add(tf5, BorderLayout.PAGE_END); leftTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel rightTextPanel = new JPanel(new GridLayout(3, 2)); rightTextPanel.add(tf2, BorderLayout.PAGE_START); rightTextPanel.add(tf4, BorderLayout.CENTER); rightTextPanel.add(tf6, BorderLayout.PAGE_END); rightTextPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 5)); JPanel tablePanel = new JPanel(new GridLayout(0, 1)); tablePanel.add(table, BorderLayout.CENTER); tablePanel.setBorder(BorderFactory.createEtchedBorder()); JPanel bottomPanel = new JPanel(new GridLayout(2, 1)); bottomPanel.add(togglePolicy, BorderLayout.PAGE_START); bottomPanel.add(label, BorderLayout.PAGE_END); add(leftTextPanel, BorderLayout.LINE_START); add(rightTextPanel, BorderLayout.CENTER); add(tablePanel, BorderLayout.LINE_END); add(bottomPanel, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:DragListDemo.java
public DragListDemo() { arrayListHandler = new ArrayListTransferHandler(); JList list1, list2;/*from w w w .j a v a2s. co m*/ DefaultListModel list1Model = new DefaultListModel(); list1Model.addElement("0 (list 1)"); list1Model.addElement("1 (list 1)"); list1Model.addElement("2 (list 1)"); list1Model.addElement("3 (list 1)"); list1Model.addElement("4 (list 1)"); list1Model.addElement("5 (list 1)"); list1Model.addElement("6 (list 1)"); list1 = new JList(list1Model); list1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list1.setTransferHandler(arrayListHandler); list1.setDragEnabled(true); JScrollPane list1View = new JScrollPane(list1); list1View.setPreferredSize(new Dimension(200, 100)); JPanel panel1 = new JPanel(); panel1.setLayout(new BorderLayout()); panel1.add(list1View, BorderLayout.CENTER); panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); DefaultListModel list2Model = new DefaultListModel(); list2Model.addElement("0 (list 2)"); list2Model.addElement("1 (list 2)"); list2Model.addElement("2 (list 2)"); list2Model.addElement("3 (list 2)"); list2Model.addElement("4 (list 2)"); list2Model.addElement("5 (list 2)"); list2Model.addElement("6 (list 2)"); list2 = new JList(list2Model); list2.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); list2.setTransferHandler(arrayListHandler); list2.setDragEnabled(true); JScrollPane list2View = new JScrollPane(list2); list2View.setPreferredSize(new Dimension(200, 100)); JPanel panel2 = new JPanel(); panel2.setLayout(new BorderLayout()); panel2.add(list2View, BorderLayout.CENTER); panel2.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); setLayout(new BorderLayout()); add(panel1, BorderLayout.LINE_START); add(panel2, BorderLayout.LINE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:FormatterFactoryDemo.java
public FormatterFactoryDemo() { super(new BorderLayout()); setUpFormats();// www . jav a2 s . c om double payment = computePayment(amount, rate, numPeriods); // Create the labels. amountLabel = new JLabel(amountString); rateLabel = new JLabel(rateString); numPeriodsLabel = new JLabel(numPeriodsString); paymentLabel = new JLabel(paymentString); // Create the text fields and set them up. amountField = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountDisplayFormat), new NumberFormatter(amountEditFormat))); amountField.setValue(new Double(amount)); amountField.setColumns(10); amountField.addPropertyChangeListener("value", this); NumberFormatter percentEditFormatter = new NumberFormatter(percentEditFormat) { public String valueToString(Object o) throws ParseException { Number number = (Number) o; if (number != null) { double d = number.doubleValue() * 100.0; number = new Double(d); } return super.valueToString(number); } public Object stringToValue(String s) throws ParseException { Number number = (Number) super.stringToValue(s); if (number != null) { double d = number.doubleValue() / 100.0; number = new Double(d); } return number; } }; rateField = new JFormattedTextField(new DefaultFormatterFactory(new NumberFormatter(percentDisplayFormat), new NumberFormatter(percentDisplayFormat), percentEditFormatter)); rateField.setValue(new Double(rate)); rateField.setColumns(10); rateField.addPropertyChangeListener("value", this); numPeriodsField = new JFormattedTextField(); numPeriodsField.setValue(new Integer(numPeriods)); numPeriodsField.setColumns(10); numPeriodsField.addPropertyChangeListener("value", this); paymentField = new JFormattedTextField(paymentFormat); paymentField.setValue(new Double(payment)); paymentField.setColumns(10); paymentField.setEditable(false); paymentField.setForeground(Color.red); // Tell accessibility tools about label/textfield pairs. amountLabel.setLabelFor(amountField); rateLabel.setLabelFor(rateField); numPeriodsLabel.setLabelFor(numPeriodsField); paymentLabel.setLabelFor(paymentField); // Lay out the labels in a panel. JPanel labelPane = new JPanel(new GridLayout(0, 1)); labelPane.add(amountLabel); labelPane.add(rateLabel); labelPane.add(numPeriodsLabel); labelPane.add(paymentLabel); // Layout the text fields in a panel. JPanel fieldPane = new JPanel(new GridLayout(0, 1)); fieldPane.add(amountField); fieldPane.add(rateField); fieldPane.add(numPeriodsField); fieldPane.add(paymentField); // Put the panels in this panel, labels on left, // text fields on right. setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); add(labelPane, BorderLayout.CENTER); add(fieldPane, BorderLayout.LINE_END); }
From source file:inet.CalculationNetworkEditor.visual.view.EditorPane.java
public EditorPane(List<Graph<V, E>> phys, List<Graph<V, E>> virts, HashMap<V, V> stackVertex, HashMap<E, List<E>> stackEdge, HashMap<V, Double> vertexRessources, HashMap<E, Double> edgeRessources, Factory<V> pVertexFactory, Factory<E> pEdgeFactory, Dimension pActDimension) { super();/*from ww w .j av a2 s .c o m*/ actDimension = pActDimension; Dimension tabbedDimensions = new Dimension((int) pActDimension.getWidth() - 200, (int) pActDimension.getHeight()); setSize(pActDimension); setPreferredSize(pActDimension); setLayout(new BorderLayout()); vertexFactory = pVertexFactory; edgeFactory = pEdgeFactory; logic = new Logic<V, E>(); logic.init(phys, virts, stackVertex, stackEdge, vertexRessources, edgeRessources); tabbedPane = new JTabbedPane(); tabbedPane.setSize(tabbedDimensions); tabbedPane.setPreferredSize(tabbedDimensions); add(tabbedPane, BorderLayout.CENTER); rightBetweenPanel = new JPanel(); rightBetweenPanel.setLayout(new BorderLayout()); rightBetweenPanel.setSize(200, 500); rightBetweenPanel.setPreferredSize(new Dimension(200, 500)); add(rightBetweenPanel, BorderLayout.LINE_END); rightPanel = new JPanel(); rightPanel.setSize(200, 500); rightPanel.setPreferredSize(new Dimension(200, 500)); rightBetweenPanel.add(rightPanel, BorderLayout.CENTER); vertexPaintTransformer = new VertexPaintTransformer<V, E>(logic, tabbedPane); vertexPaintTransformerStacking = new VertexPaintTransformerStacking<V, E>(logic, tabbedPane); edgePaintTransformer = new EdgePaintTransformer<V, E>(logic, tabbedPane); edgeStrokeTransformer = new EdgeStrokeTransformer<V, E>(logic, tabbedPane); // init VisualisationViewer visViewPhysical = new VisualizationViewerPhysical<V, E>(logic.getDisplay(IStorage.Type.PHYSICAL), vertexPaintTransformer, edgePaintTransformer, edgeStrokeTransformer, this); visViewVirtual = new VisualizationViewerVirtual<V, E>(logic.getDisplay(IStorage.Type.VIRTUAL), vertexPaintTransformer, edgePaintTransformer, edgeStrokeTransformer, this); visViewBoth = new VisualizationViewerBoth<V, E>(logic.getDisplay(null), vertexPaintTransformer, vertexPaintTransformerStacking, edgePaintTransformer, edgeStrokeTransformer, this); vc = new ViewController<V, E>(this, visViewPhysical, visViewVirtual, visViewBoth); bc = new BackendController<V, E>(logic, pVertexFactory, pEdgeFactory); mouseAbstraction = new MouseAbstraction<V, E>(vc, bc, this); editingPanelsListener = new EditingPanelsListener<V, E>(this, bc); visViewPhysical.setMouseAbstraction(mouseAbstraction); visViewVirtual.setMouseAbstraction(mouseAbstraction); visViewBoth.setMouseAbstraction(mouseAbstraction); /* visViewPhysical.setGraphMouse(mgm); visViewVirtual.setGraphMouse(mgm); visViewBoth.setGraphMouse(mgm); */ vertexPaintTransformer.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth); vertexPaintTransformerStacking.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth); edgePaintTransformer.setVisualizationViewers(visViewPhysical, visViewVirtual, visViewBoth); /* deprecatedMML = new Controller( layoutPhysical, layoutVirtual, layoutBoth, visViewPhysical, visViewVirtual, visViewBoth, tabbedPane, logic, physGraph, virtGraph, vertexFactory, edgeFactory); //, // mousePhysical, mouseVirtual, mouseBoth); */ //visViewStateChangedListener = new VisualViewerStateChangedListener(visViewPhysical, visViewVirtual, visViewBoth); tabSwitchListener = new TabSwitchedListener(this, tabbedPane);//,deprecatedMML); reinitializeTabPane(); addComponentListener(new ComponentResizedListener(tabbedPane, this)); add(tabbedPane, BorderLayout.CENTER); //add(vv); }