Search in sources :

Example 6 with JComponent

use of javax.swing.JComponent in project android-parcelable-intellij-plugin by mcharmas.

the class GenerateDialog method createSouthPanel.

@Nullable
@Override
protected JComponent createSouthPanel() {
    JComponent southPanel = super.createSouthPanel();
    if (showCheckbox && southPanel != null) {
        final VerticalBox combinedView = new VerticalBox();
        combinedView.add(includeSubclasses);
        combinedView.add(southPanel);
        return combinedView;
    } else {
        return southPanel;
    }
}
Also used : VerticalBox(com.intellij.ui.components.panels.VerticalBox) JComponent(javax.swing.JComponent) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with JComponent

use of javax.swing.JComponent in project openblocks by mikaelhg.

the class CWheeler method scrollLeft.

public void scrollLeft() {
    int v = scroll.getHorizontalModel().getValue();
    int accumulatedWidth = 0;
    for (JComponent element : elements) {
        accumulatedWidth = accumulatedWidth + element.getWidth();
        if (accumulatedWidth >= v) {
            accumulatedWidth = accumulatedWidth - element.getWidth();
            break;
        }
    }
    scroll.getHorizontalModel().setValue(accumulatedWidth);
    scroll.revalidate();
    scroll.repaint();
}
Also used : JComponent(javax.swing.JComponent)

Example 8 with JComponent

use of javax.swing.JComponent in project openblocks by mikaelhg.

the class CWheeler method scrollRight.

public void scrollRight() {
    int v = scroll.getHorizontalModel().getValue();
    int accumulatedWidth = 0;
    for (JComponent element : elements) {
        accumulatedWidth = accumulatedWidth + element.getWidth();
        if (accumulatedWidth > v) {
            break;
        }
    }
    scroll.getHorizontalModel().setValue(accumulatedWidth);
    scroll.revalidate();
    scroll.repaint();
}
Also used : JComponent(javax.swing.JComponent)

Example 9 with JComponent

use of javax.swing.JComponent in project openblocks by mikaelhg.

the class CWheeler method reformItems.

private void reformItems() {
    int totalWidth = 0;
    int maxHeight = 0;
    for (JComponent element : elements) {
        element.setBounds(totalWidth, 0, element.getPreferredSize().width, element.getPreferredSize().height);
        totalWidth = totalWidth + element.getPreferredSize().width;
        maxHeight = Math.max(maxHeight, element.getPreferredSize().height);
    }
    view.setPreferredSize(new Dimension(totalWidth, maxHeight));
    view.setBounds(0, 0, totalWidth, maxHeight);
    this.revalidate();
    this.repaint();
}
Also used : JComponent(javax.swing.JComponent) Dimension(java.awt.Dimension)

Example 10 with JComponent

use of javax.swing.JComponent in project openblocks by mikaelhg.

the class TabbedExplorer method setDrawersCard.

/**
     * Reassigns the set of canvases that this explorer controls.
     * Though the collection of canvas mnay be empty, it may not be null.
     * @param items
     *
     * @requires items != null &&
     * 			 for each element in item, element!= null
     */
public void setDrawersCard(List<? extends Canvas> items) {
    drawerCards.clear();
    menu.removeAll();
    List<JComponent> buttons = new ArrayList<JComponent>();
    for (int i = 0; i < items.size(); i++) {
        TabCard card = new TabCard(i, items.get(i), this, scrollable);
        drawerCards.add(card);
        buttons.add(card.getButton());
        card.getButton().setPreferredSize(new Dimension(125, BUTTON_HEIGHT));
        menu.add(card.getMenuItem());
    }
    wheeler.setElements(buttons);
    this.selectCanvas(0);
}
Also used : ArrayList(java.util.ArrayList) JComponent(javax.swing.JComponent) Dimension(java.awt.Dimension)

Aggregations

JComponent (javax.swing.JComponent)159 Component (java.awt.Component)30 JButton (javax.swing.JButton)22 JPanel (javax.swing.JPanel)22 BorderLayout (java.awt.BorderLayout)18 Dimension (java.awt.Dimension)17 Insets (java.awt.Insets)15 JLabel (javax.swing.JLabel)15 ActionEvent (java.awt.event.ActionEvent)11 JFrame (javax.swing.JFrame)11 Color (java.awt.Color)10 ActionListener (java.awt.event.ActionListener)10 ArrayList (java.util.ArrayList)10 Point (java.awt.Point)9 Container (java.awt.Container)8 GridBagConstraints (java.awt.GridBagConstraints)8 JTextField (javax.swing.JTextField)8 Graphics (java.awt.Graphics)7 GridBagLayout (java.awt.GridBagLayout)7 File (java.io.File)7