List of usage examples for javax.swing BoxLayout BoxLayout
@ConstructorProperties({ "target", "axis" }) public BoxLayout(Container target, int axis)
From source file:components.LayeredPaneDemo.java
public LayeredPaneDemo() { setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); //Create and load the duke icon. final ImageIcon icon = createImageIcon("images/dukeWaveRed.gif"); //Create and set up the layered pane. layeredPane = new JLayeredPane(); layeredPane.setPreferredSize(new Dimension(300, 310)); layeredPane.setBorder(BorderFactory.createTitledBorder("Move the Mouse to Move Duke")); layeredPane.addMouseMotionListener(this); //This is the origin of the first label added. Point origin = new Point(10, 20); //This is the offset for computing the origin for the next label. int offset = 35; //Add several overlapping, colored labels to the layered pane //using absolute positioning/sizing. for (int i = 0; i < layerStrings.length; i++) { JLabel label = createColoredLabel(layerStrings[i], layerColors[i], origin); layeredPane.add(label, new Integer(i)); origin.x += offset;// ww w . j a va2s .co m origin.y += offset; } //Create and add the Duke label to the layered pane. dukeLabel = new JLabel(icon); if (icon != null) { dukeLabel.setBounds(15, 225, icon.getIconWidth(), icon.getIconHeight()); } else { System.err.println("Duke icon not found; using black square instead."); dukeLabel.setBounds(15, 225, 30, 30); dukeLabel.setOpaque(true); dukeLabel.setBackground(Color.BLACK); } layeredPane.add(dukeLabel, new Integer(2), 0); //Add control pane and layered pane to this JPanel. add(Box.createRigidArea(new Dimension(0, 10))); add(createControlPanel()); add(Box.createRigidArea(new Dimension(0, 10))); add(layeredPane); }
From source file:gdt.jgui.tool.JIconSelector.java
/** * The default constructor.//from ww w . jav a 2 s .com */ public JIconSelector() { FlowLayout flowLayout = new FlowLayout(FlowLayout.LEFT, 5, 5); flowLayout.setAlignOnBaseline(true); WrapLayout wrapLayout = new WrapLayout(FlowLayout.LEFT, 5, 5); wrapLayout.setAlignOnBaseline(true); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); panel = new JPanel(); panel.setLayout(wrapLayout); scrollPane = new JScrollPane(panel); add(scrollPane); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); }
From source file:mergedoc.ui.PreferencePanel.java
/** * ??//w w w . ja v a 2s . c o m * @throws MergeDocException ???????? */ public PreferencePanel() throws MergeDocException { // setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setMaximumSize(ComponentFactory.createMaxDimension()); // ???? add(createUpperPanel()); add(ComponentFactory.createSpacer(0, 7)); add(createLowerPanel()); }
From source file:com.idealista.solrmeter.view.statistic.OperationTimeLineChartPanel.java
@Inject public OperationTimeLineChartPanel(OperationTimeHistory statistic) { super();//from ww w .j a v a 2s . c om this.statistic = statistic; this.xyDataset = new DefaultXYDataset(); this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.add(this.createChartPanel()); this.add(this.createCheckBoxPanel()); }
From source file:com.game.ui.views.ItemPanel.java
public void doGui() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JLabel noteLbl = new JLabel( "<html><div style='width : 500px;'>Pls select a value from the dropdown or you can create a new " + "entity below. Once selected an Item, its' details will be available below</div></html>"); noteLbl.setAlignmentX(0);/* w w w . ja v a 2 s.c o m*/ add(noteLbl); DefaultComboBoxModel model = new DefaultComboBoxModel(); if (ringPanel) { for (Item item : GameBean.ringDetails) { model.addElement(((Ring) item).getName()); } } else if (armourPanel) { for (Item item : GameBean.armourDetails) { model.addElement(((Armour) item).getName()); } } else if (potionPanel) { for (Item item : GameBean.potionDetails) { model.addElement(((Potion) item).getName()); } } else if (treasurePanel) { for (Item item : GameBean.treasureDetails) { model.addElement(((Treasure) item).getName()); } } doCommonStuffForDropDown(model); doCommonStuffForContent(); }
From source file:QandE.LunarPhasesRB.java
public LunarPhasesRB() { //Create the phase selection and display panels. selectPanel = new JPanel(); displayPanel = new JPanel(); //Add various widgets to the sub panels. addWidgets();/*from w w w . j a v a 2s. c om*/ //Create the main panel to contain the two sub panels. mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.PAGE_AXIS)); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); //Add the select and display panels to the main panel. mainPanel.add(selectPanel); mainPanel.add(displayPanel); }
From source file:CoordinatesDemo.java
private void buildUI(Container container) { container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); CoordinateArea coordinateArea = new CoordinateArea(this); container.add(coordinateArea);//from ww w . j av a 2s . c o m label = new JLabel(); resetLabel(); container.add(label); //Align the left edges of the components. coordinateArea.setAlignmentX(Component.LEFT_ALIGNMENT); label.setAlignmentX(Component.LEFT_ALIGNMENT); //redundant }
From source file:com.idealista.solrmeter.view.statistic.PieChartPanel.java
private Component createCustomizePanel() { JButton jButtonCustomize = new JButton(I18n.get("statistic.pieChartPanel.customize")); jButtonCustomize.addActionListener(new ActionListener() { @Override/*from w w w .j a va2 s . co m*/ public void actionPerformed(ActionEvent e) { JDialogCustomizePieChart dialog = new JDialogCustomizePieChart(SolrMeterMain.mainFrame, timeRangeStatistic); dialog.setVisible(true); } }); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10)); panel.add(Box.createHorizontalGlue()); panel.add(jButtonCustomize); return panel; }
From source file:TextInputDemo.java
public TextInputDemo() { setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); JPanel leftHalf = new JPanel() { //Don't allow us to stretch vertically. public Dimension getMaximumSize() { Dimension pref = getPreferredSize(); return new Dimension(Integer.MAX_VALUE, pref.height); }// ww w .j av a 2 s. c om }; leftHalf.setLayout(new BoxLayout(leftHalf, BoxLayout.PAGE_AXIS)); leftHalf.add(createEntryFields()); leftHalf.add(createButtons()); add(leftHalf); add(createAddressDisplay()); }
From source file:view.tabtables.EmulationTablesDrawer.java
/** * @param data/*from ww w . jav a2 s .c o m*/ */ public EmulationTablesDrawer(Data data, EmulationManager emulator, JFrame mainFrame) { BoxLayout boxY = new BoxLayout(this, BoxLayout.Y_AXIS); setLayout(boxY); setAlignmentX(CENTER_ALIGNMENT); this.data = data; this.emulator = emulator; this.curStep = 0; tablesInitialize(); graphsInitialize(); }