Java Code Examples for java.awt.GridBagLayout#addLayoutComponent()

The following examples show how to use java.awt.GridBagLayout#addLayoutComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CodeViewer.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
protected JComponent createCodeHighlightBar() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    JPanel bar = new JPanel(gridbag);
    
    bar.setBorder(new EmptyBorder(0, 0, 10, 0));
    
    NO_SNIPPET_SELECTED = getString("CodeViewer.snippets.selectOne", 
                                    "Select One");
   
    JLabel snippetSetsLabel = new JLabel(getString("CodeViewer.snippets.highlightCode",
                                                   "Highlight code to: "));
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 0;
    gridbag.addLayoutComponent(snippetSetsLabel, c);
    bar.add(snippetSetsLabel);
    
    snippetComboBox = new JComboBox();
    snippetComboBox.setMaximumRowCount(20);
    snippetComboBox.setRenderer(new SnippetCellRenderer(snippetComboBox.getRenderer()));
    snippetComboBox.addActionListener(new SnippetActivator());
    snippetSetsLabel.setLabelFor(snippetComboBox);
    c.gridx++;
    c.weightx = 1;
    gridbag.addLayoutComponent(snippetComboBox, c);
    bar.add(snippetComboBox);
        
    SnippetNavigator snippetNavigator = new SnippetNavigator(snippetMap);
    snippetNavigator.setNavigateNextAction(nextSnippetAction);
    snippetNavigator.setNavigatePreviousAction(previousSnippetAction);
    c.gridx++;
    c.anchor = GridBagConstraints.EAST;
    c.weightx = 0;
    gridbag.addLayoutComponent(snippetNavigator, c);
    bar.add(snippetNavigator);
    
    return bar;              
}
 
Example 2
Source File: Stacker.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
/**
 * Fades in the specified message component in the top layer of this
 * layered pane.
 * @param message the component to be displayed in the message layer
 * @param finalAlpha the alpha value of the component when fade in is complete
 */
public void showMessageLayer(JComponent message, final float finalAlpha) {
    messageLayer = new JPanel();
    messageLayer.setOpaque(false);
    GridBagLayout gridbag = new GridBagLayout();
    messageLayer.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;

    messageAlpha = new JXPanel();
    messageAlpha.setOpaque(false);
    messageAlpha.setAlpha(0.0f);
    gridbag.addLayoutComponent(messageAlpha, c);
    messageLayer.add(messageAlpha);
    messageAlpha.add(message);

    add(messageLayer, JLayeredPane.POPUP_LAYER);
    revalidate();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Animator animator = new Animator(2000,
                    new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
            animator.setStartDelay(200);
            animator.setAcceleration(.2f);
            animator.setDeceleration(.5f);
            animator.start();
        }
    });
}
 
Example 3
Source File: CodeViewer.java    From littleluck with Apache License 2.0 5 votes vote down vote up
protected JComponent createCodeHighlightBar() {
    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();
    JPanel bar = new JPanel(gridbag);
    
    bar.setBorder(new EmptyBorder(0, 0, 10, 0));
    
    NO_SNIPPET_SELECTED = getString("CodeViewer.snippets.selectOne", 
                                    "Select One");
   
    JLabel snippetSetsLabel = new JLabel(getString("CodeViewer.snippets.highlightCode",
                                                   "Highlight code to: "));
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 0;
    gridbag.addLayoutComponent(snippetSetsLabel, c);
    bar.add(snippetSetsLabel);
    
    snippetComboBox = new JComboBox();
    snippetComboBox.setMaximumRowCount(20);
    snippetComboBox.setRenderer(new SnippetCellRenderer(snippetComboBox.getRenderer()));
    snippetComboBox.addActionListener(new SnippetActivator());
    snippetSetsLabel.setLabelFor(snippetComboBox);
    c.gridx++;
    c.weightx = 1;
    gridbag.addLayoutComponent(snippetComboBox, c);
    bar.add(snippetComboBox);
        
    SnippetNavigator snippetNavigator = new SnippetNavigator(snippetMap);
    snippetNavigator.setNavigateNextAction(nextSnippetAction);
    snippetNavigator.setNavigatePreviousAction(previousSnippetAction);
    c.gridx++;
    c.anchor = GridBagConstraints.EAST;
    c.weightx = 0;
    gridbag.addLayoutComponent(snippetNavigator, c);
    bar.add(snippetNavigator);
    
    return bar;              
}
 
Example 4
Source File: Stacker.java    From littleluck with Apache License 2.0 5 votes vote down vote up
/**
 * Fades in the specified message component in the top layer of this
 * layered pane.
 * @param message the component to be displayed in the message layer
 * @param finalAlpha the alpha value of the component when fade in is complete
 */
public void showMessageLayer(JComponent message, final float finalAlpha) {
    messageLayer = new JPanel();
    messageLayer.setOpaque(false);
    GridBagLayout gridbag = new GridBagLayout();
    messageLayer.setLayout(gridbag);
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.CENTER;

    messageAlpha = new JXPanel();
    messageAlpha.setOpaque(false);
    messageAlpha.setAlpha(0.0f);
    gridbag.addLayoutComponent(messageAlpha, c);
    messageLayer.add(messageAlpha);
    messageAlpha.add(message);

    add(messageLayer, JLayeredPane.POPUP_LAYER);
    revalidate();
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            Animator animator = new Animator(2000,
                    new PropertySetter(messageAlpha, "alpha", 0.0f, finalAlpha));
            animator.setStartDelay(200);
            animator.setAcceleration(.2f);
            animator.setDeceleration(.5f);
            animator.start();
        }
    });
}
 
Example 5
Source File: java_awt_GridBagLayout.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 6
Source File: java_awt_GridBagLayout.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 7
Source File: java_awt_GridBagLayout.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 8
Source File: java_awt_GridBagLayout.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 9
Source File: java_awt_GridBagLayout.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 10
Source File: java_awt_GridBagLayout.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 11
Source File: java_awt_GridBagLayout.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 12
Source File: java_awt_GridBagLayout.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 13
Source File: java_awt_GridBagLayout.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 14
Source File: java_awt_GridBagLayout.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 15
Source File: java_awt_GridBagLayout.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 16
Source File: java_awt_GridBagLayout.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}
 
Example 17
Source File: java_awt_GridBagLayout.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static void update(GridBagLayout layout, String id, int x, int y) {
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = x;
    gbc.gridy = y;
    layout.addLayoutComponent(new JLabel(id), gbc);
}