Java 8 Box - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Box class.

This code example shows how to use the following methods:add, setAlignmentX, setBorder, setMaximumSize
      titleBar.setOpaque(true);
      titleBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));
      titleBar.setSize(titleBar.getPreferredSize());
      titleBar.setVisible(false);                  
       
      buttons = new Box(BoxLayout.X_AXIS); 
      defaultButton = new Button("Close");
      buttons.add(defaultButton);
      buttons.setBorder(BorderFactory.createEmptyBorder(15,5,5,5));
       
      content.add(titleBar);
      content.add(textPane);
      content.add(buttons);
 
      // this allows the title bar to take the whole width of the dialog box 
      titleBar.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      buttons.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
      textPane.setMaximumSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
       
      // these allow all the parts to left aligned 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add
        b3.add(Box.createHorizontalGlue());
        b3.add(size);
        b3.add(Box.createHorizontalGlue());
        b3.add(Box.createHorizontalStrut(5));
         
        Box b4 = new Box(BoxLayout.Y_AXIS);
        b4.add(b2);
        b4.add(b3);
        add(b4, BorderLayout.SOUTH);
    } 
 
    /** 
     * Set the preview image. 
     * @param img the preview image 
     */ 
    public void setImage(Image img) {
        image = getScaledImage(img);
        stateChanged(null); 
    } 
     
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add, getComponentCount
     */ 
    @Override 
    public Component add(Component c) {
        // This won't work right if we remove components. But we don't, so I'm 
        // not going to worry about it right now. 
        if (vgap > 0 && subPanel.getComponentCount() > 0) {
            subPanel.add(Box.createVerticalStrut(vgap));
        } 
 
        if (c instanceof JComponent) {
            ((JComponent) c).setAlignmentX(horizontalAlign);
        } 
 
        return subPanel.add(c);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add, getComponentCount
     */ 
    @Override 
    public Component add(Component c) {
        // This won't work right if we remove components. But we don't, so I'm 
        // not going to worry about it right now. 
        if (hgap > 0 && subPanel.getComponentCount() > 0) {
            subPanel.add(Box.createHorizontalStrut(hgap));
        } 
 
        if (c instanceof JComponent) {
            ((JComponent) c).setAlignmentY(verticalAlign);
        } 
        return subPanel.add(c);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:repaint, getComponentCount, invalidate, remove
This code example shows how to use the following methods:add
 
 
    protected void createUI(JComponent parent) {
        setInstructions("Please choose an option:"); 
        parent.setLayout(new BorderLayout());
        Box box = new Box(BoxLayout.Y_AXIS);
        box.add(localFileRadioButton = new JRadioButton("Import an ontology contained in a specific file."));
        box.add(webRadioButton = new JRadioButton("Import an ontology contained in a document located on the web."));
        box.add(loadedOntologyButton = new JRadioButton("Import an ontology that is already loaded in the workspace."));
        box.add(libraryRadioButton = new JRadioButton("Import an ontology that is contained in one of the ontology libraries."));
        parent.add(box, BorderLayout.NORTH);
        ButtonGroup bg = new ButtonGroup();
        bg.add(webRadioButton);
        bg.add(localFileRadioButton);
        bg.add(libraryRadioButton);
        bg.add(loadedOntologyButton);
        localFileRadioButton.setSelected(true);
    } 
 
 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add
	private final JRadioButton remoteButton;
 
	private NewRepositoryDialog() { 
		super(RapidMinerGUI.getMainFrame(), "repositorydialog", true, new Object[]{}); 
 
		Box firstPage = new Box(BoxLayout.Y_AXIS);
		ButtonGroup checkBoxGroup = new ButtonGroup();
		localButton = new JRadioButton(new ResourceActionAdapter("new_local_repositiory"));
		remoteButton = new JRadioButton(new ResourceActionAdapter("new_remote_repositiory"));
		checkBoxGroup.add(localButton);
		checkBoxGroup.add(remoteButton);
		firstPage.add(localButton);
		firstPage.add(remoteButton);
		firstPage.add(Box.createVerticalGlue());
		localButton.setSelected(true);
 
		Map<String,Component> cards = new HashMap<String,Component>();
		cards.put("first", firstPage);		
		cards.put("remote", remoteRepositoryPanel);
		cards.put("local", localRepositoryPanel);

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     * Create the JMeter tool bar pane containing the running indicator. 
     * 
     * @return a panel containing the running indicator 
     */ 
    protected Component createToolBar() {
        Box toolPanel = new Box(BoxLayout.X_AXIS);
        toolPanel.add(Box.createRigidArea(new Dimension(10, 15)));
        toolPanel.add(Box.createGlue());
        toolPanel.add(runningIndicator);
        return toolPanel;
    } 
 
    /** 
     * Create the panel where the GUI representation of the test tree is 
     * displayed. The tree should already be created before calling this method. 
     * 
     * @return a scroll pane containing the test tree GUI 
     */ 
    protected JScrollPane createTreePanel() {
        JScrollPane treeP = new JScrollPane(tree);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add
 
    protected void createUI(JComponent parent) {
        parent.setLayout(new BorderLayout());
        setInstructions("Please choose what you want to do in order to resolve the missing import"); 
        ButtonGroup bg = new ButtonGroup();
        Box box = new Box(BoxLayout.Y_AXIS);
        specifyFileRadioButton = new JRadioButton("Specify a file containing the ontology");
        box.add(specifyFileRadioButton);
        bg.add(specifyFileRadioButton);
        box.add(Box.createVerticalStrut(3));
        specifyLibraryButton = new JRadioButton("Add a new ontology library that contains the ontology");
        box.add(specifyLibraryButton);
        bg.add(specifyLibraryButton);
        specifyFileRadioButton.setSelected(true);
        parent.add(box, BorderLayout.NORTH);
    } 
 
 
    public Object getNextPanelDescriptor() { 
        if (specifyFileRadioButton.isSelected()) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:add
package guiprograms; 
 
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JApplet;
import javax.swing.JButton;
 
public class BoxLayoutExample extends JApplet {
 
	public void init () { 
		Box box = new Box(BoxLayout.Y_AXIS);
		add(box);        
		box.add(new JButton("One"));
		box.add(new JButton("Two"));  
		box.add(new JButton("Three"));
		box.add(new JButton("Four"));
		box.add(new JButton("Five"));         
		box.add(new JButton("Six"));      
	} 
} 

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Box Methods: