List of usage examples for java.awt BorderLayout EAST
String EAST
To view the source code for java.awt BorderLayout EAST.
Click Source Link
From source file:org.formic.wizard.form.gui.component.FileChooser.java
/** * Creates a new instance./*from w w w. j a v a 2 s . com*/ */ public FileChooser(int selectionMode, String choosable) { super(new BorderLayout()); chooser = new JFileChooser() { private static final long serialVersionUID = 1L; // force "proper" behavior of <enter> when a button has focus protected boolean processKeyBinding(KeyStroke key, KeyEvent event, int condition, boolean pressed) { if (event.getKeyCode() == KeyEvent.VK_ENTER) { Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); // if a button has focus, click it. if (focusOwner instanceof JButton) { ((JButton) focusOwner).doClick(); return true; } } return super.processKeyBinding(key, event, condition, pressed); } }; chooser.setFileSelectionMode(selectionMode); addChoosableFileFilters(choosable); textField = new JTextField(); button = new JButton(Installer.getString("browse.text")); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { int result = chooser.showOpenDialog(getParent()); if (result == JFileChooser.APPROVE_OPTION) { textField.setText(chooser.getSelectedFile().getPath()); textField.requestFocus(); } } }); add(textField, BorderLayout.CENTER); add(button, BorderLayout.EAST); }
From source file:net.sf.firemox.ui.wizard.Wizard.java
/** * Create a new instance of this class.//from www. j av a 2 s . c o m * * @param ability * ability to associate to this ability. If this ability has an * associated picture, it will be used instead of given picture. * Ability's name is also used to fill the title. This ability will * be used to restart this wizard in case of Background button is * used. * @param title * the title of this wizard. * @param description * the description appended to the title of this wizard. This content * will be displayed as Html. * @param iconName * the icon's name to display on the top right place. * @param width * the preferred width. * @param height * the preferred height. */ public Wizard(Ability ability, String title, String description, String iconName, int width, int height) { super(MagicUIComponents.magicForm, StringUtils.capitalize(title), true); getRootPane().setPreferredSize(new Dimension(width, 300)); getRootPane().setMinimumSize(new Dimension(width, height)); setSize(new Dimension(width, height)); // center gameParamPanel = new JPanel(null); gameParamPanel.setLayout(new BoxLayout(gameParamPanel, BoxLayout.Y_AXIS)); if (ability == null) getContentPane().add(new WizardTitle(new WizardImageIcon((Image) null, iconName), description), BorderLayout.NORTH); else getContentPane().add(new WizardTitle(new WizardImageIcon(ability.getCard(), iconName), description), BorderLayout.NORTH); getContentPane().add(gameParamPanel, BorderLayout.CENTER); getContentPane().add(new JPanel(), BorderLayout.EAST); // bottom final JPanel abstractButtonPanel = new JPanel(new BorderLayout()); this.buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); this.ability = ability; abstractButtonPanel.setBorder(null); abstractButtonPanel.add(new JSeparator(), BorderLayout.NORTH); abstractButtonPanel.add(buttonPanel, BorderLayout.CENTER); abstractButtonPanel.add(wizardInfo, BorderLayout.SOUTH); getContentPane().add(abstractButtonPanel, BorderLayout.SOUTH); setLocationRelativeTo(null); }
From source file:playground.sergioo.facilitiesGenerator2012.gui.ClustersWindow.java
public ClustersWindow(String title, Map<Integer, Cluster<Double>> clusters, int numTotalPoints) { setTitle(title);//ww w.j av a 2 s . c o m setDefaultCloseOperation(EXIT_ON_CLOSE); this.setLocation(0, 0); this.setLayout(new BorderLayout()); layersPanels.put(PanelIds.ONE, new ClustersPanel(this, clusters, numTotalPoints)); this.add(layersPanels.get(PanelIds.ONE), BorderLayout.CENTER); option = Options.ZOOM; JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(Options.values().length, 1)); for (Options option : Options.values()) { JButton optionButton = new JButton(option.getCaption()); optionButton.setActionCommand(option.getCaption()); optionButton.addActionListener(this); buttonsPanel.add(optionButton); } this.add(buttonsPanel, BorderLayout.EAST); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); readyButton = new JButton("Ready to exit"); readyButton.addActionListener(this); readyButton.setActionCommand(READY_TO_EXIT); infoPanel.add(readyButton, BorderLayout.WEST); JPanel labelsPanel = new JPanel(); labelsPanel.setLayout(new GridLayout(1, Labels.values().length)); labelsPanel.setBorder(new TitledBorder("Information")); labels = new JTextField[Labels.values().length]; for (int i = 0; i < Labels.values().length; i++) { labels[i] = new JTextField(""); labels[i].setEditable(false); labels[i].setBackground(null); labels[i].setBorder(null); labelsPanel.add(labels[i]); } infoPanel.add(labelsPanel, BorderLayout.CENTER); JPanel coordsPanel = new JPanel(); coordsPanel.setLayout(new GridLayout(1, 2)); coordsPanel.setBorder(new TitledBorder("Coordinates")); coordsPanel.add(lblCoords[0]); coordsPanel.add(lblCoords[1]); infoPanel.add(coordsPanel, BorderLayout.EAST); this.add(infoPanel, BorderLayout.SOUTH); pack(); }
From source file:playground.sergioo.workplaceCapacities2012.gui.ClustersWindow.java
public ClustersWindow(String title, Map<Integer, Cluster<Double>> clusters, int numTotalPoints) { setTitle(title);/*from w w w . j av a 2 s . co m*/ setDefaultCloseOperation(HIDE_ON_CLOSE); this.setLocation(0, 0); this.setLayout(new BorderLayout()); layersPanels.put(PanelIds.ONE, new ClustersPanel(this, clusters, numTotalPoints)); this.add(layersPanels.get(PanelIds.ONE), BorderLayout.CENTER); option = Options.ZOOM; JPanel buttonsPanel = new JPanel(); buttonsPanel.setLayout(new GridLayout(Options.values().length, 1)); for (Options option : Options.values()) { JButton optionButton = new JButton(option.getCaption()); optionButton.setActionCommand(option.getCaption()); optionButton.addActionListener(this); buttonsPanel.add(optionButton); } this.add(buttonsPanel, BorderLayout.EAST); JPanel infoPanel = new JPanel(); infoPanel.setLayout(new BorderLayout()); readyButton = new JButton("Ready to exit"); readyButton.addActionListener(this); readyButton.setActionCommand(READY_TO_EXIT); infoPanel.add(readyButton, BorderLayout.WEST); JPanel labelsPanel = new JPanel(); labelsPanel.setLayout(new GridLayout(1, Labels.values().length)); labelsPanel.setBorder(new TitledBorder("Information")); labels = new JTextField[Labels.values().length]; for (int i = 0; i < Labels.values().length; i++) { labels[i] = new JTextField(""); labels[i].setEditable(false); labels[i].setBackground(null); labels[i].setBorder(null); labelsPanel.add(labels[i]); } infoPanel.add(labelsPanel, BorderLayout.CENTER); JPanel coordsPanel = new JPanel(); coordsPanel.setLayout(new GridLayout(1, 2)); coordsPanel.setBorder(new TitledBorder("Coordinates")); coordsPanel.add(lblCoords[0]); coordsPanel.add(lblCoords[1]); infoPanel.add(coordsPanel, BorderLayout.EAST); this.add(infoPanel, BorderLayout.SOUTH); pack(); }
From source file:uk.co.markfrimston.tasktree.Main.java
public Main(TaskTree taskTree) { super();//from w ww . j a v a2 s .c om this.taskTree = taskTree; this.setTitle("Task Tree"); this.setSize(new Dimension(300, 500)); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel quickInPanel = new JPanel(new BorderLayout()); this.quickIn = new JTextArea(); this.quickIn.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent arg0) { if (arg0.getKeyCode() == KeyEvent.VK_ENTER) { String newText = quickIn.getText().trim(); if (newText != null && newText.length() > 0) { addTask(Main.this.taskTree.getRoot(), 0, newText, true); try { Main.this.taskTree.changesMade(); } catch (Exception e) { error(e.getMessage()); } } quickIn.setText(""); } } }); this.quickIn.setPreferredSize(new Dimension(300, 75)); this.quickIn.setBorder(BorderFactory.createTitledBorder("Quick Input")); quickInPanel.add(this.quickIn, BorderLayout.CENTER); this.syncButton = new JButton("Sync"); this.syncButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new SyncThread(Main.this).start(); } }); quickInPanel.add(this.syncButton, BorderLayout.EAST); this.getContentPane().add(quickInPanel, BorderLayout.NORTH); this.tree = new JTree(taskTree.getTreeModel()); DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer() { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; Object newVal = htmlFilter(String.valueOf(node.getUserObject())); if (node.getChildCount() > 0 && !tree.isExpanded(new TreePath(node.getPath()))) { DefaultMutableTreeNode firstLeaf = (DefaultMutableTreeNode) node.getFirstLeaf(); newVal = htmlFilter(String.valueOf(node.getUserObject())) + " <span style='color:silver;font-style:italic'>" + "(" + String.valueOf(firstLeaf.getUserObject()) + ")</span>"; } newVal = "<html>" + newVal + "</html>"; return super.getTreeCellRendererComponent(tree, newVal, selected, expanded, leaf, row, hasFocus); } }; ImageIcon bulletIcon = new ImageIcon(Main.class.getResource("bullet.gif")); renderer.setLeafIcon(bulletIcon); renderer.setOpenIcon(bulletIcon); renderer.setClosedIcon(bulletIcon); renderer.setBorder(BorderFactory.createEmptyBorder(4, 0, 4, 0)); this.tree.setCellRenderer(renderer); this.tree.setRootVisible(false); this.tree.setShowsRootHandles(true); this.tree.addMouseListener(new MouseAdapter() { protected void doSelectRow(MouseEvent arg0) { int row = tree.getRowForLocation(arg0.getX(), arg0.getY()); if (row != -1) { tree.setSelectionRow(row); if (arg0.isPopupTrigger()) { popup.show(tree, arg0.getX(), arg0.getY()); } } } public void mousePressed(MouseEvent arg0) { doSelectRow(arg0); } public void mouseReleased(MouseEvent arg0) { doSelectRow(arg0); } }); JScrollPane treeScroll = new JScrollPane(tree); treeScroll.setBorder(BorderFactory.createTitledBorder("Task List")); this.getContentPane().add(treeScroll, BorderLayout.CENTER); this.popup = new JPopupMenu(); JMenuItem addBefore = new JMenuItem("Add Before"); addBefore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); int pos = parent.getIndex(selected); promptAndInsert(parent, pos); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(addBefore); JMenuItem addAfter = new JMenuItem("Add After"); addAfter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); int pos = parent.getIndex(selected) + 1; promptAndInsert(parent, pos); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(addAfter); JMenuItem addNested = new JMenuItem("Add Nested"); addNested.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); int pos = selected.getChildCount(); promptAndInsert(selected, pos); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { ex.getMessage(); } } }); this.popup.add(addNested); this.popup.add(new JSeparator()); JMenuItem moveTop = new JMenuItem("Move to Top"); moveTop.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); moveTask(selected, parent, 0); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(moveTop); JMenuItem moveUp = new JMenuItem("Move Up"); moveUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); int pos = Math.max(parent.getIndex(selected) - 1, 0); moveTask(selected, parent, pos); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(moveUp); JMenuItem moveDown = new JMenuItem("Move Down"); moveDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); int pos = Math.min(parent.getIndex(selected) + 1, parent.getChildCount() - 1); moveTask(selected, parent, pos); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(moveDown); JMenuItem moveBottom = new JMenuItem("Move to Bottom"); moveBottom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent(); moveTask(selected, parent, parent.getChildCount() - 1); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(moveBottom); this.popup.add(new JSeparator()); JMenuItem rename = new JMenuItem("Edit"); rename.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { DefaultMutableTreeNode selected = getSelectedNode(); String newText = prompt((String) selected.getUserObject()); if (newText != null && newText.length() > 0) { selected.setUserObject(newText); Main.this.taskTree.getTreeModel().reload(selected); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } } }); this.popup.add(rename); JMenuItem delete = new JMenuItem("Delete"); delete.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { promptAndRemove(getSelectedNode()); try { Main.this.taskTree.changesMade(); } catch (Exception ex) { error(ex.getMessage()); } } }); this.popup.add(delete); this.setVisible(true); loadConfig(); load(); syncButton.setVisible(this.taskTree.hasSyncCapability()); }
From source file:org.ut.biolab.medsavant.client.view.notify.NotificationsPanel.java
private void initUI() { this.setOpaque(false); this.setLayout(new BorderLayout()); npanelContainer = ViewUtil.getClearPanel(); npanelContainer.setLayout(/*from w w w. j a va 2s . c om*/ new MigLayout(String.format("insets %d %d %d %d, gapy %d, fillx, alignx trailing, wrap, hidemode 3", this.verticalOffset + inset, inset, inset, inset, gap))); this.add(npanelContainer, BorderLayout.EAST); inactiveButtonIcon = IconFactory.getInstance() .getIcon(IconFactory.ICON_ROOT + "notifications-inactive.png"); activeButtonIcon = IconFactory.getInstance().getIcon(IconFactory.ICON_ROOT + "notifications-active.png"); }
From source file:org.apache.commons.jelly.demos.HomepageBuilder.java
public HomepageBuilder() { System.out.println("Starting Homepage Builder"); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); leftPanel.add(new JLabel("Name:")); nameField = new JTextField("James Bond"); leftPanel.add(nameField);/*from w w w.ja v a 2 s. c om*/ leftPanel.add(new JLabel("Favorite Color:")); colorField = new JTextField("#007007"); leftPanel.add(colorField); leftPanel.add(new JLabel("Picture URL:")); urlField = new JTextField("http://www.ianfleming.org/007news/images3/c2002_pierce1.jpg"); leftPanel.add(urlField); leftPanel.add(new JLabel("Choose template:")); templateList = new JComboBox(new String[] { "template1.jelly", "template2.jelly" }); leftPanel.add(templateList); // JPanel rightPanel = new JPanel(); // rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); leftPanel.add(new JLabel("Add a Hobby:")); addField = new JTextField(); leftPanel.add(addField); JButton addButton = new JButton("Add >>>"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { listModel.addElement(addField.getText()); } }); leftPanel.add(addButton); listModel = new DefaultListModel(); listModel.addElement("Killing bad guys"); listModel.addElement("Wrecking cars"); listModel.addElement("Eating jelly"); interestList = new JList(listModel); JButton submit = new JButton("Build and preview your page!"); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { buildPage(templateList.getSelectedItem().toString(), new JellyContext()); showPage(); } }); // Layout the demo setLayout(new BorderLayout()); add(submit, BorderLayout.SOUTH); add(leftPanel, BorderLayout.WEST); add(new JScrollPane(interestList), BorderLayout.EAST); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
From source file:livecanvas.mesheditor.MeshEditor.java
public MeshEditor() { super("Mesh Editor", new ImageIcon(clazz.getResource("res/mesh_editor.png")), new BorderLayout()); setPreferredSize(new Dimension(1024, 600)); setBackground(Color.darkGray); tools = createTools();/*from w w w .j a v a2 s . c om*/ add(tools, BorderLayout.WEST); selectedColor = Color.black; JPanel east = new JPanel(new BorderLayout()); east.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); Layer rootLayer = new Layer("ROOT"); rootLayer.addSubLayer(new Layer("Layer1")); layersView = new LayersView(rootLayer); chain(layersView); layersView.addListener(this); east.add(layersView, BorderLayout.NORTH); propertiesPanel = new JPanel(new BorderLayout()); east.add(propertiesPanel); viewpointsView = new ViewpointsView(layersView.getSelectedLayer()); viewpointsView.addListener(this); east.add(viewpointsView, BorderLayout.SOUTH); add(east, BorderLayout.EAST); JPanel center = new JPanel(new BorderLayout()); center.setBackground(Color.lightGray); canvas = new CanvasMesh(800, 600); canvas.setCurrLayer(getRootLayer()); pointerHandler = new AffineTransformPointerHandler(canvas); canvas.setPointerHandler(pointerHandler); canvasContainer = new CanvasContainer(canvas); rootLayer.setCanvas(canvas); center.add(canvasContainer); renderImageSettings = new RenderImageSettings(); settings = new MeshEditorSettings(canvas.getSettings(), layersView.getSettings(), renderImageSettings); add(center); layersView.layersList.setSelectedIndex(1); setSelectedToolType(TOOLS_BRUSH); }
From source file:es.emergya.ui.base.Message.java
private void inicializar(final String texto) { log.trace("inicializar(" + texto + ")"); final Message message_ = this; SwingUtilities.invokeLater(new Runnable() { @Override/* w w w . ja v a 2 s . c o m*/ public void run() { log.trace("Sacamos un nuevo mensaje: " + texto); JDialog frame = new JDialog(window.getFrame(), true); frame.setUndecorated(true); frame.getContentPane().setBackground(Color.WHITE); frame.setLocation(150, window.getHeight() - 140); frame.setSize(new Dimension(window.getWidth() - 160, 130)); frame.setName("Incoming Message"); frame.setBackground(Color.WHITE); frame.getRootPane().setBorder(new MatteBorder(4, 4, 4, 4, color)); frame.setLayout(new BorderLayout()); if (font != null) frame.setFont(font); JLabel icon = new JLabel(new ImageIcon(this.getClass().getResource("/images/button-ok.png"))); icon.setToolTipText("Cerrar"); icon.removeMouseListener(null); icon.addMouseListener(new Cerrar(frame, message_)); JLabel text = new JLabel(texto); text.setBackground(Color.WHITE); text.setForeground(Color.BLACK); frame.add(text, BorderLayout.WEST); frame.add(icon, BorderLayout.EAST); frame.setVisible(true); } }); }
From source file:com.intel.stl.ui.monitor.view.PSEventsPieChart.java
protected void initComponents() { setLayout(new BorderLayout()); pieDataset = new DefaultPieDataset(); StateLongTypeViz[] states = StateLongTypeViz.values(); for (int i = 0; i < states.length; i++) { pieDataset.setValue(states[i], 0); }//from w w w . ja v a 2 s . com //Create the pie chart panel and put it on this panel pieChartPanel = new ChartPanel(ComponentFactory.createPlainPieChart(pieDataset, StateLongTypeViz.colors)); pieChartPanel.setPreferredSize(new Dimension(80, 8)); add(pieChartPanel); //Create the legend panel and put it on this panel JPanel legendPanel = getLengendPanel(); add(legendPanel, BorderLayout.EAST); }