Java 8 Container - 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 Container 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
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add, setLayout, setBorder
This code example shows how to use the following methods:add, setLayout
         
        return size;
    } 
 
    protected void initComponents() { 
        Panel buttonPanel = new Panel();
        buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
        JButton okButton = new JButton(LocalisationHelper.getString("button_ok"));
        okButton.setActionCommand(ACTION_OK);
        okButton.addActionListener(this);
        buttonPanel.add(okButton);
         
        getContentPane().add("South", buttonPanel);
    } 
     
    public void setVisible(boolean visible) {
        if (visible) {
            setLocation((int) frame.getLocation().getX() + (frame.getWidth() / 2) - (getWidth() / 2), 
                    (int) frame.getLocation().getY() + (frame.getHeight() / 2) - (getHeight() / 2));
        } 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
            add(mainPanel, BorderLayout.CENTER);
 
        } else { 
            // Embedded 
            setLayout(new BorderLayout());
            add(createConditionPanel(), BorderLayout.NORTH);
        } 
    } 
 
    /** 
     * Create a GUI panel containing the condition. 
     * 
     * @return a GUI panel containing the condition components 
     */ 
    private JPanel createConditionPanel() {
        JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
 
        // Condition LABEL 
        JLabel conditionLabel = new JLabel(JMeterUtils.getResString("if_controller_label")); // $NON-NLS-1$
        conditionPanel.add(conditionLabel, BorderLayout.WEST);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
            add(mainPanel, BorderLayout.CENTER);
 
        } else { 
            // Embedded 
            setLayout(new BorderLayout());
            add(createCriticalSectionPanel(), BorderLayout.NORTH);
        } 
    } 
 
    /** 
     * Create a GUI panel containing the lockName 
     *  
     * @return a GUI panel containing the lock name components 
     */ 
    private JPanel createCriticalSectionPanel() {
        JPanel conditionPanel = new JPanel(new BorderLayout(5, 0));
 
        // Condition LABEL 
        JLabel conditionLabel = new JLabel(
                JMeterUtils.getResString("critical_section_controller_label")); // $NON-NLS-1$ 

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add, setLayout, setBackground
    private void init() {// called from ctor, so must not be overridable 
        setLayout(new BorderLayout(10, 10));
        setBorder(makeBorder()); 
        setBackground(Color.white);
 
        JPanel pane = new JPanel();
        pane.setLayout(new BorderLayout(10,10));
        pane.setBackground(Color.white);
        pane.add(this.getNamePanel(),BorderLayout.NORTH);
 
        outputDirectory.setBackground(Color.white);
 
        pane.add(outputDirectory,BorderLayout.SOUTH);
        add(pane,BorderLayout.NORTH);
    } 
 
    /* (non-Javadoc) 
     * @see org.apache.jmeter.gui.JMeterGUIComponent#createTestElement() 
     */ 
    @Override 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add, setLayout
        preferredGLSize = new Dimension(400,200);
    } 
 
    private void setupFrameAndShow(final Frame f, final java.awt.Component comp) throws InterruptedException, InvocationTargetException {
 
        final Container c = new Container();
        c.setLayout(new BorderLayout());
        c.add(new Button("north"), BorderLayout.NORTH);
        c.add(new Button("south"), BorderLayout.SOUTH);
        c.add(new Button("east"), BorderLayout.EAST);
        c.add(new Button("west"), BorderLayout.WEST);
        c.add(comp, BorderLayout.CENTER);
 
        f.setLayout(new BorderLayout());
        f.add(new Button("NORTH"), BorderLayout.NORTH);
        f.add(new Button("SOUTH"), BorderLayout.SOUTH);
        f.add(new Button("EAST"), BorderLayout.EAST);
        f.add(new Button("WEST"), BorderLayout.WEST);
        f.add(c, BorderLayout.CENTER);
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add, setLayout, setBackground
    private void init() { 
        setLayout(new BorderLayout(10, 10));
        setBorder(makeBorder()); 
        setBackground(Color.white);
 
        JPanel pane = new JPanel();
        pane.setLayout(new BorderLayout(10,10));
        pane.setBackground(Color.white);
        pane.add(this.getNamePanel(),BorderLayout.NORTH);
 
        VerticalPanel options = new VerticalPanel(Color.white);
        pageTitle.setBackground(Color.white);
        makeIndex.setBackground(Color.white);
        cssURL.setBackground(Color.white);
        headerURL.setBackground(Color.white);
        footerURL.setBackground(Color.white);
        introduction.setBackground(Color.white);
        options.add(pageTitle);
        options.add(makeIndex);
        options.add(cssURL);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getGraphicsConfiguration, getSize, getX, getY
        centerFrameOnScreen(dialog);
        return; 
      } 
 
      final Dimension d = dialog.getSize();
      final Dimension p = parent.getSize();
 
      final int baseX = parent.getX();
      final int baseY = parent.getY();
 
      final int x = baseX + (int) (horizontalPercent * p.width);
      final int y = baseY + (int) (verticalPercent * p.height);
 
      // make sure the dialog fits completely on the screen... 
      final Rectangle s = parent.getGraphicsConfiguration().getBounds();
      final Rectangle r = new Rectangle(x, y, d.width, d.height);
      dialog.setBounds(r.intersection(s));
    } 
 
    /** 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:add
    private static final long serialVersionUID = -8640087805737551918L;
 
    boolean accept = false;
 
    public CompareImageDialog(RenderedImage expected, RenderedImage actual, boolean showCommands) {
        JPanel content = new JPanel(new BorderLayout());
        this.setContentPane(content);
        this.setTitle("ImageAssert");
        String message;
        if (expected.getWidth() != actual.getWidth() || expected.getHeight() != actual.getHeight()) {
            message = "Image sizes are different, expected " + expected.getWidth() + "x"
                    + expected.getHeight() + " but actual is " + actual.getWidth() + "x"
                    + actual.getHeight();
        } else { 
            message = "The two images are perceptibly different.";
        } 
        final JLabel topLabel = new JLabel(
                "<html><body>" + message + "</html></body>");
        topLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
        content.add(topLabel, BorderLayout.NORTH);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Java 8 Container Methods: