Java 8 JPanel - 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 JPanel class.

This code example shows how to use the following methods:add, setLayout, setBorder
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
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
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
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
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
This code example shows how to use the following methods:add, setBorder
6
CodeRank
This code example shows how to use the following methods:add, setLayout, JPanel.add
   void init(String text){
       
      setBackground(Color.yellow);
      setForeground(Color.black);      
       
      JPanel content = new JPanel();
      content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
      add(content);
             
      textPane = new TextPane();   
      textPane.setText(text);
      textPane.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5));
       
      Color darkyellow = new Color(238,185,57);
       
      titleBar = new JLabel();           
      titleBar.setFont(new Font("sansserif", Font.BOLD, 14));
      titleBar.setBackground(darkyellow);
      titleBar.setOpaque(true);
      titleBar.setBorder(BorderFactory.createEmptyBorder(5, 5, 3, 5));

7
CodeRank
This code example shows how to use the following methods:addMouseListener, setBackground, setMinimumSize
    public DrawingFrame() 
    { 
        super("Extender-Based Host"); 
 
        m_toolbar = new JToolBar("Toolbar");
        m_panel = new JPanel();
        m_panel.setBackground(Color.WHITE);
        m_panel.setLayout(null);
        m_panel.setMinimumSize(new Dimension(400, 400));
        m_panel.addMouseListener(this);
        getContentPane().setLayout(new BorderLayout());
        getContentPane().add(m_toolbar, BorderLayout.NORTH);
        getContentPane().add(m_panel, BorderLayout.CENTER);
        setSize(400, 400);
    } 
 
    /** 
     * This method sets the currently selected shape to be used for drawing 
     * on the canvas. 
     * @param name The name of the shape to use for drawing on the canvas. 
6
CodeRank
This code example shows how to use the following methods:add, setBorder
 
    /** 
     * This will create the test panel in the LdapConfigGui. 
     */ 
    private JPanel createTestPanel() {
        JPanel testPanel = new JPanel(new BorderLayout());
        testPanel.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("test_configuration"))); // $NON-NLS-1$
 
        testPanel.add(new JLabel(JMeterUtils.getResString("test"))); // $NON-NLS-1$
        JPanel rowPanel = new JPanel();
 
        rowPanel.add(addTest);
        bGroup.add(addTest);
        rowPanel.add(deleteTest);
        bGroup.add(deleteTest);
        rowPanel.add(searchTest);
        bGroup.add(searchTest);
        rowPanel.add(modifyTest);
        bGroup.add(modifyTest);
        testPanel.add(rowPanel, BorderLayout.NORTH);

6
CodeRank
See Code Examples for Java 8 JPanel Methods: