List of usage examples for java.awt BorderLayout LINE_START
String LINE_START
To view the source code for java.awt BorderLayout LINE_START.
Click Source Link
From source file:net.pms.newgui.SelectRenderers.java
public void build() { JPanel checkPanel = new JPanel(); checkPanel.applyComponentOrientation(ComponentOrientation.getOrientation(PMS.getLocale())); add(checkPanel, BorderLayout.LINE_START); allRenderers = new SearchableMutableTreeNode(Messages.getString("GeneralTab.13")); Pattern pattern = Pattern.compile("^\\s*([^\\s]*) ?([^\\s].*?)?\\s*$"); for (String renderer : RendererConfiguration.getAllRenderersNames()) { Matcher match = pattern.matcher(renderer); if (match.find()) { // Find or create group or single name renderer SearchableMutableTreeNode node = null; try { node = allRenderers.findChild(match.group(1)); } catch (IllegalChildException e) { }/*from w ww .j av a 2 s . com*/ if (node == null) { node = new SearchableMutableTreeNode(match.group(1)); allRenderers.add(node); } // Find or create subgroup/name if (match.groupCount() > 1 && match.group(2) != null) { SearchableMutableTreeNode subNode = null; try { subNode = node.findChild(match.group(2)); } catch (IllegalChildException e) { } if (subNode != null) { LOGGER.warn("Renderer {} found twice, ignoring repeated entry", renderer); } else { subNode = new SearchableMutableTreeNode(match.group(2)); node.add(subNode); } } } else { LOGGER.warn("Can't parse renderer name \"{}\"", renderer); } } SrvTree = new JTree(new DefaultTreeModel(allRenderers)); checkTreeManager = new CheckTreeManager(SrvTree); checkPanel.add(new JScrollPane(SrvTree)); checkPanel.setSize(400, 500); }
From source file:MenuLayoutDemo.java
/** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread./*from www.j a v a2 s.c o m*/ */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new JFrame("MenuLayoutDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. MenuLayoutDemo demo = new MenuLayoutDemo(); Container contentPane = frame.getContentPane(); contentPane.setBackground(Color.WHITE); //contrasting bg contentPane.add(demo.createMenuBar(), BorderLayout.LINE_START); //Display the window. frame.setSize(300, 150); frame.setVisible(true); }
From source file:Interface.ResultadoJanela.java
public ResultadoJanela(List<Resultado> tar, List<Resultado> jac, List<Resultado> och, List<Resultado> sbi) { // super("Resultado"); CategoryDataset dataset;//from w w w. j a v a 2 s. c om //---------------------gerando resultados tarantula------------------------------------- dataset = gerarDataset(tar, jac, och, sbi); JFreeChart chart = gerarGrafico(dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setDomainZoomable(true); JLabel lAjuda = new JLabel("Ajuda", JLabel.RIGHT); lAjuda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icone_informacao.gif"))); // NOI18N lAjuda.setPreferredSize(new Dimension(50, 50)); lAjuda.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { lAjudaMouseClicked(evt); } }); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(lAjuda, BorderLayout.BEFORE_FIRST_LINE); panel.add(chartPanel, BorderLayout.LINE_START); JLabel lTabela = new JLabel("Tabela de Resultados", JLabel.CENTER); panel.add(lTabela, BorderLayout.SOUTH); JTable table = new JTable(criarValores(tar, jac, och, sbi), criarColunas()); // Adiciona o JTable dentro do painel JScrollPane scrollPane = new JScrollPane(table); table.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); panel.add(scrollPane, BorderLayout.SOUTH); JFrame frame = new JFrame(); frame.setTitle("JLoc - Resultado"); frame.setVisible(true); frame.add(panel); frame.pack(); frame.setVisible(true); }
From source file:integratedprogressdemo.WeatherData.java
private WeatherData(boolean displayProgress) { setBackground(Color.WHITE);//from w w w . j a va 2 s . 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: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);/* w w w . j a va 2s .c o 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:components.SliderDemo2.java
public SliderDemo2() { super(new BorderLayout()); delay = 1000 / FPS_INIT;/*from ww w . j ava2s . co m*/ //Create the slider. JSlider framesPerSecond = new JSlider(JSlider.VERTICAL, FPS_MIN, FPS_MAX, FPS_INIT); framesPerSecond.addChangeListener(this); framesPerSecond.setMajorTickSpacing(10); framesPerSecond.setPaintTicks(true); //Create the label table. Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>(); //PENDING: could use images, but we don't have any good ones. labelTable.put(new Integer(0), new JLabel("Stop")); //new JLabel(createImageIcon("images/stop.gif")) ); labelTable.put(new Integer(FPS_MAX / 10), new JLabel("Slow")); //new JLabel(createImageIcon("images/slow.gif")) ); labelTable.put(new Integer(FPS_MAX), new JLabel("Fast")); //new JLabel(createImageIcon("images/fast.gif")) ); framesPerSecond.setLabelTable(labelTable); framesPerSecond.setPaintLabels(true); framesPerSecond.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); //Create the label that displays the animation. picture = new JLabel(); picture.setHorizontalAlignment(JLabel.CENTER); picture.setAlignmentX(Component.CENTER_ALIGNMENT); picture.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(), BorderFactory.createEmptyBorder(10, 10, 10, 10))); updatePicture(0); //display first frame //Put everything together. add(framesPerSecond, BorderLayout.LINE_START); add(picture, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); //Set up a timer that calls this object's action handler. timer = new Timer(delay, this); timer.setInitialDelay(delay * 7); //We pause animation twice per cycle //by restarting the timer timer.setCoalesce(true); }
From source file:com.microsoft.alm.plugin.idea.ui.common.tabs.TabFormImpl.java
/** * Create the tab view if not already done *//*from w ww . ja v a 2 s . c om*/ 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:components.CheckBoxDemo.java
public CheckBoxDemo() { super(new BorderLayout()); //Create the check boxes. chinButton = new JCheckBox("Chin"); chinButton.setMnemonic(KeyEvent.VK_C); chinButton.setSelected(true);//from ww w. ja v a2 s. c om glassesButton = new JCheckBox("Glasses"); glassesButton.setMnemonic(KeyEvent.VK_G); glassesButton.setSelected(true); hairButton = new JCheckBox("Hair"); hairButton.setMnemonic(KeyEvent.VK_H); hairButton.setSelected(true); teethButton = new JCheckBox("Teeth"); teethButton.setMnemonic(KeyEvent.VK_T); teethButton.setSelected(true); //Register a listener for the check boxes. chinButton.addItemListener(this); glassesButton.addItemListener(this); hairButton.addItemListener(this); teethButton.addItemListener(this); //Indicates what's on the geek. choices = new StringBuffer("cght"); //Set up the picture label pictureLabel = new JLabel(); pictureLabel.setFont(pictureLabel.getFont().deriveFont(Font.ITALIC)); updatePicture(); //Put the check boxes in a column in a panel JPanel checkPanel = new JPanel(new GridLayout(0, 1)); checkPanel.add(chinButton); checkPanel.add(glassesButton); checkPanel.add(hairButton); checkPanel.add(teethButton); add(checkPanel, BorderLayout.LINE_START); add(pictureLabel, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }
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);/* www .java2 s. c o 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:CheckBoxDemo.java
public CheckBoxDemo() { super(new BorderLayout()); // Create the check boxes. chinButton = new JCheckBox("Chin"); chinButton.setMnemonic(KeyEvent.VK_C); chinButton.setSelected(true);//from ww w.j av a 2 s . co m glassesButton = new JCheckBox("Glasses"); glassesButton.setMnemonic(KeyEvent.VK_G); glassesButton.setSelected(true); hairButton = new JCheckBox("Hair"); hairButton.setMnemonic(KeyEvent.VK_H); hairButton.setSelected(true); teethButton = new JCheckBox("Teeth"); teethButton.setMnemonic(KeyEvent.VK_T); teethButton.setSelected(true); // Register a listener for the check boxes. chinButton.addItemListener(this); glassesButton.addItemListener(this); hairButton.addItemListener(this); teethButton.addItemListener(this); // Indicates what's on the geek. choices = new StringBuffer("cght"); // Set up the picture label pictureLabel = new JLabel(); pictureLabel.setFont(pictureLabel.getFont().deriveFont(Font.ITALIC)); updatePicture(); // Put the check boxes in a column in a panel JPanel checkPanel = new JPanel(new GridLayout(0, 1)); checkPanel.add(chinButton); checkPanel.add(glassesButton); checkPanel.add(hairButton); checkPanel.add(teethButton); add(checkPanel, BorderLayout.LINE_START); add(pictureLabel, BorderLayout.CENTER); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); }