Java Code Examples for javax.swing.JLabel#setIcon()

The following examples show how to use javax.swing.JLabel#setIcon() . 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: TaskPanel.java    From netbeans with Apache License 2.0 7 votes vote down vote up
@NbBundle.Messages({
    "IssuePanel.noSummary=Missing summary."
})
private void updateMessagePanel () {
    messagePanel.removeAll();
    if (noSummary) {
        JLabel noSummaryLabel = new JLabel();
        noSummaryLabel.setText(Bundle.IssuePanel_noSummary());
        String icon = "org/netbeans/modules/localtasks/resources/error.gif"; //NOI18N
        noSummaryLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(icon)));
        messagePanel.add(noSummaryLabel);
    }
    if (noSummary) {
        messagePanel.setVisible(true);
        messagePanel.revalidate();
    } else {
        messagePanel.setVisible(false);
    }
}
 
Example 2
Source File: RegistrationStatusPanel.java    From Spark with Apache License 2.0 6 votes vote down vote up
public RegistrationStatusPanel() {
    setLayout(new GridBagLayout());

    loadingLabel = new JLabel();
    loadingLabel.setIcon(PhoneRes.getImageIcon("NORMAL_PHONE_ICON"));
    loadingLabel.setHorizontalAlignment(JLabel.LEFT);
    loadingLabel.setFont(new Font("Verdana", Font.BOLD, 11));

    add(loadingLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0));

    retryButton = new RectangleButton();
    retryButton.setText(PhoneRes.getIString("phone.tryagain"));
    add(retryButton, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 2, 2, 0), 0, 0));
    retryButton.setVisible(false);

    closeButton = new CloseButton();
    add(closeButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2, 0, 2, 2), 0, 0));

    // Set Border
    setBorder(BorderFactory.createLineBorder(new Color(197, 213, 230), 1));

    closeButton.addActionListener(this);
    retryButton.addActionListener(this);
}
 
Example 3
Source File: ImShow.java    From ImageEnhanceViaFusion with MIT License 6 votes vote down vote up
public ImShow(String title, int height, int width) {
	SizeCustom = true;
	Height = height;
	Width = width;

	Window = new JFrame();
	image = new ImageIcon();
	label = new JLabel();
	// matOfByte = new MatOfByte();
	label.setIcon(image);
	Window.getContentPane().add(label);
	Window.setResizable(false);
	Window.setTitle(title);
	setCloseOption(0);

}
 
Example 4
Source File: MarketOrdersTab.java    From jeveassets with GNU General Public License v2.0 6 votes vote down vote up
private void update(JLabel jLastUpdate, Date lastUpdate, Images images) {
	if (lastUpdate != null) {
		long diff = Math.abs(System.currentTimeMillis() - lastUpdate.getTime());
		long diffMinutes = diff / (60 * 1000) % 60;
		jLastUpdate.setOpaque(true);
		if (diffMinutes < 2) {
			jLastUpdate.setIcon(new IconColorIcon(Colors.STRONG_GREEN.getColor(), images.getImage()));
			ColorSettings.config(jLastUpdate, ColorEntry.GLOBAL_ENTRY_VALID);
		} else if (diffMinutes < 5) {
			jLastUpdate.setIcon(new IconColorIcon(Colors.STRONG_YELLOW.getColor(), images.getImage()));
			ColorSettings.config(jLastUpdate, ColorEntry.GLOBAL_ENTRY_WARNING);
		} else {
			jLastUpdate.setIcon(new IconColorIcon(Colors.STRONG_RED.getColor(), images.getImage()));
			ColorSettings.config(jLastUpdate, ColorEntry.GLOBAL_ENTRY_INVALID);
		}
		jLastUpdate.setText(Formater.milliseconds(diff, false, false, true, true, true, true));
	} else {
		jLastUpdate.setOpaque(false);
		jLastUpdate.setIcon(images.getIcon());
		jLastUpdate.setText(TabsOrders.get().none());
	}
}
 
Example 5
Source File: StockpileShoppingListDialog.java    From jeveassets with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<? extends String> list, String value, int index, boolean isSelected, boolean cellHasFocus) {
	Component component = renderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
	if (component instanceof JLabel) {
		JLabel jLabel = (JLabel) component;
		jLabel.setIcon(icons.get(value));
	}
	return component;
}
 
Example 6
Source File: BattleDisplay.java    From triplea with GNU General Public License v3.0 5 votes vote down vote up
void updateStamp(final JLabel stamp) {
  if (count == 0) {
    stamp.setText("");
    stamp.setIcon(null);
    stamp.setToolTipText(null);
  } else {
    stamp.setText("x" + count);
    icon.ifPresent(stamp::setIcon);
    MapUnitTooltipManager.setUnitTooltip(stamp, unitType, player, count);
  }
}
 
Example 7
Source File: MainPanel.java    From jpexs-decompiler with GNU General Public License v3.0 5 votes vote down vote up
private static void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) {
    tabbedPane.add(tab);

    JLabel lbl = new JLabel(title);
    lbl.setIcon(icon);
    lbl.setIconTextGap(5);
    lbl.setHorizontalTextPosition(SwingConstants.RIGHT);

    tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl);
}
 
Example 8
Source File: GoToPopup.java    From cakephp3-netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(
        JList<?> list,
        Object value,
        int index,
        boolean isSelected,
        boolean cellHasFocus) {
    JLabel c = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);

    if (value instanceof GoToItem) {
        GoToItem item = (GoToItem) value;
        c.setIcon(item.getIcon());
    }
    return c;
}
 
Example 9
Source File: JavaImgConverter.java    From easyCV with Apache License 2.0 5 votes vote down vote up
/**
 * 使用窗口显示BufferedImage图片
 * @param image -BufferedImage
 */
public static void viewImage(BufferedImage image) {
	int width=image.getWidth(),height=image.getHeight();
	JLabel label = new JLabel();
	label.setSize(width, height);
	label.setIcon(new ImageIcon(image));

	JFrame frame = new JFrame();
	frame.setSize(width, height);
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	frame.add(label);
	frame.setVisible(true);
}
 
Example 10
Source File: FileNodeRenderer.java    From jAudioGIT with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
	 * Get the component used to display the current row. Used for both directories and leaf nodes.
	 *
	 * @see javax.swing.tree.DefaultTreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree,
	 *      java.lang.Object, boolean, boolean, boolean, int, boolean)
	 */
	public Component getTreeCellRendererComponent(JTree tree, Object value,
			boolean sel, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
//		this.setLeafIcon(defaultLeaf);
		try {
			Component ret = ((FileNode) value).render(tree, value, sel,
					expanded, leaf, row, hasFocus);
			if (ret != null) {
				return ret;
			}
			
			if (!leaf) {
//				System.out.println("Default rendering used ");
				return super.getTreeCellRendererComponent(tree,((FileNode)value).getText(),sel,expanded,leaf,row,hasFocus);
			} else {
				Icon icon = ((FileNode) value).getIcon();
				String text = ((FileNode) value).getText();
				JLabel label = new JLabel();
				
				if (icon != null) {
					label.setIcon(icon);
				}else{
					label.setIcon(super.getLeafIcon());
				}
				label.setText(text);
				ret = label;
				return ret;
			}
		} catch (ClassCastException e) {
			return super.getTreeCellRendererComponent(tree, value, sel, expanded,
							leaf, row, hasFocus);
		}
	}
 
Example 11
Source File: ImShow.java    From ImageEnhanceViaFusion with MIT License 5 votes vote down vote up
public ImShow(String title) {
	Window = new JFrame();
	image = new ImageIcon();
	label = new JLabel();
	// matOfByte = new MatOfByte();
	label.setIcon(image);
	Window.getContentPane().add(label);
	Window.setResizable(false);
	Window.setTitle(title);
	SizeCustom = false;
	setCloseOption(0);
}
 
Example 12
Source File: RowHeaderTable.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean hasFocus) {
    final JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, hasFocus);
    if (iconEnable && index == 0) {
        label.setIcon(ICON);
    } else if (index == 1) {
        final Font font = label.getFont().deriveFont(10.0f);
        label.setFont(font);
        label.setForeground(Color.GRAY);
    }
    return label;
}
 
Example 13
Source File: ConfigureDataView.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
											   int row, int column) {
	JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
	label.setText(null);
	label.setIcon((ImageIcon) value);
	return label;
}
 
Example 14
Source File: AttributesPropertyDialog.java    From rapidminer-studio with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Create a list cell renderer for lists that show attributes and their value types.
 *
 * @return the renderer, never {@code null}
 */
private DefaultListCellRenderer createAttributeTypeListRenderer() {
	return new DefaultListCellRenderer() {

		@Override
		public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
			JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			String stringValue = (String) value;
			Integer type = valueTypeMap.get(stringValue);
			if (type != null) {
				Icon icon;
				if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(type, Ontology.NUMERICAL)) {
					icon = AttributeGuiTools.NUMERICAL_COLUMN_ICON;
				} else if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(type, Ontology.NOMINAL)) {
					icon = AttributeGuiTools.NOMINAL_COLUMN_ICON;
				} else if (Ontology.ATTRIBUTE_VALUE_TYPE.isA(type, Ontology.DATE_TIME)) {
					icon = AttributeGuiTools.DATE_COLUMN_ICON;
				} else {
					// attribute value type
					icon = AttributeGuiTools.UNKNOWN_COLUMN_ICON;
				}
				label.setIcon(icon);
			}
			return label;
		}
	};
}
 
Example 15
Source File: DiscoMixer.java    From aurous-app with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Initialize the contents of the frame.
 */
private void initialize() {
	discoFrame = new JFrame();
	discoFrame.setTitle("Disco Mixer");
	discoFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(
			DiscoMixer.class.getResource("/resources/aurouslogo.png")));
	discoFrame.setType(Type.UTILITY);
	discoFrame.setResizable(false);
	discoFrame.setBounds(100, 100, 606, 239);
	discoFrame
	.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
	discoFrame.getContentPane().setLayout(null);
	discoFrame.addWindowListener(new java.awt.event.WindowAdapter() {
		@Override
		public void windowClosing(
				final java.awt.event.WindowEvent windowEvent) {
			final int confirm = JOptionPane.showOptionDialog(discoFrame,
					"Are You Sure You Want to Close Disco Mixer?",
					"Exit Confirmation", JOptionPane.YES_NO_OPTION,
					JOptionPane.QUESTION_MESSAGE, null, null, null);
			if (confirm == 0) {
				Playlist.getPlaylist().discoOpen = false;
				discoFrame.dispose();
			}

		}
	});

	final JLabel logoLabel = new JLabel("");
	logoLabel.setHorizontalAlignment(SwingConstants.CENTER);
	logoLabel.setIcon(new ImageIcon(DiscoMixer.class
			.getResource("/resources/fmw.png")));
	logoLabel.setBounds(10, 0, 580, 70);
	discoFrame.getContentPane().add(logoLabel);

	discoProgressBar = new JProgressBar();
	discoProgressBar.setStringPainted(true);
	discoProgressBar.setBounds(113, 119, 380, 49);
	discoProgressBar.setVisible(false);
	discoFrame.getContentPane().add(discoProgressBar);

	queryField = new JTextField();
	queryField.setFont(new Font("Segoe UI", Font.PLAIN, 20));
	queryField.setHorizontalAlignment(SwingConstants.CENTER);
	queryField.setBounds(113, 119, 380, 44);
	discoFrame.getContentPane().add(queryField);
	queryField.setColumns(10);

	final JLabel instructionsLabel = new JLabel(
			"Enter an Artist, Song or Choose from the Top 100!");
	instructionsLabel.setFont(new Font("Segoe UI", Font.PLAIN, 20));
	instructionsLabel.setHorizontalAlignment(SwingConstants.CENTER);
	instructionsLabel.setBounds(23, 81, 541, 27);
	discoFrame.getContentPane().add(instructionsLabel);

	discoBuildButton = new JButton("Disco!");
	discoBuildButton.addActionListener(e -> {
		if (!queryField.getText().trim().isEmpty()) {
			discoProgressBar.setVisible(true);
			YouTubeDiscoUtils.buildDiscoPlayList(queryField.getText());
		} else {
			JOptionPane.showMessageDialog(discoFrame,
					"Please enter search query", "Error",
					JOptionPane.ERROR_MESSAGE);
			return;
		}
	});
	discoBuildButton.setForeground(Color.BLACK);
	discoBuildButton.setBounds(197, 174, 100, 26);
	discoFrame.getContentPane().add(discoBuildButton);

	top100Button = new JButton("Top Hits!");
	top100Button.addActionListener(e -> {
		discoProgressBar.setVisible(true);
		YouTubeDiscoUtils.buildTopPlayList();
	});
	top100Button.setForeground(Color.BLACK);
	top100Button.setBounds(307, 174, 100, 26);
	discoFrame.getContentPane().add(top100Button);
	Playlist.getPlaylist().discoOpen = true;
	final GhostText ghostText = new GhostText("Ghost B.C.", queryField);
	ghostText.setHorizontalAlignment(SwingConstants.CENTER);
	discoFrame.setLocationRelativeTo(UISession.getPresenter().jfxPanel);
}
 
Example 16
Source File: JreForm.java    From magarena with GNU General Public License v3.0 4 votes vote down vote up
public JPanel createPanel1()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _varCombo.setName("varCombo");
   jpanel1.add(_varCombo,cc.xy(3,1));

   _propertyButton.setActionCommand("Add");
   _propertyButton.setIcon(loadImage("images/edit_add16.png"));
   _propertyButton.setName("propertyButton");
   _propertyButton.setText(Messages.getString("property"));
   _propertyButton.setToolTipText(Messages.getString("propertyTip"));
   jpanel1.add(_propertyButton,cc.xy(5,1));

   _optionButton.setActionCommand("Add");
   _optionButton.setIcon(loadImage("images/edit_add16.png"));
   _optionButton.setName("optionButton");
   _optionButton.setText(Messages.getString("option"));
   _optionButton.setToolTipText(Messages.getString("optionTip"));
   jpanel1.add(_optionButton,cc.xy(7,1));

   _envPropertyButton.setActionCommand("Add");
   _envPropertyButton.setIcon(loadImage("images/edit_add16.png"));
   _envPropertyButton.setName("envPropertyButton");
   _envPropertyButton.setText(Messages.getString("property"));
   _envPropertyButton.setToolTipText(Messages.getString("propertyTip"));
   jpanel1.add(_envPropertyButton,cc.xy(5,3));

   JLabel jlabel1 = new JLabel();
   jlabel1.setText(Messages.getString("varsAndRegistry"));
   jpanel1.add(jlabel1,cc.xy(1,1));

   JLabel jlabel2 = new JLabel();
   jlabel2.setIcon(loadImage("images/asterix.gif"));
   jlabel2.setText(Messages.getString("envVar"));
   jpanel1.add(jlabel2,cc.xy(1,3));

   _envOptionButton.setActionCommand("Add");
   _envOptionButton.setIcon(loadImage("images/edit_add16.png"));
   _envOptionButton.setName("envOptionButton");
   _envOptionButton.setText(Messages.getString("option"));
   _envOptionButton.setToolTipText(Messages.getString("optionTip"));
   jpanel1.add(_envOptionButton,cc.xy(7,3));

   _envVarField.setName("envVarField");
   jpanel1.add(_envVarField,cc.xy(3,3));

   addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 });
   return jpanel1;
}
 
Example 17
Source File: ETableHeader.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    
    TableColumn tcm = getColumnModel().getColumn(column);
    TableCellRenderer headerRenderer = getColumnHeaderRenderer(tcm);
    Component resUI = headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    if (resUI instanceof JLabel) {
        JLabel label = (JLabel)resUI;

        String valueString = "";
        if (value != null) {
            valueString = value.toString();
        }
        if (table instanceof ETable) {
            ETable et = (ETable)table;
            valueString = et.getColumnDisplayName(valueString);
        }
        Icon sortIcon = null;

        List<TableColumn> sortedColumns = ((ETableColumnModel) table.getColumnModel ()).getSortedColumns ();
        
        int sortRank = 0;
        boolean ascending = false;
        Icon customIcon = null;
        if (tcm instanceof ETableColumn) {
            ETableColumn eColumn = (ETableColumn) tcm;
            sortRank = eColumn.getSortRank();
            ascending = eColumn.isAscending();
            customIcon = eColumn.getCustomIcon();
        }

        if (sortRank != 0) {
            if (sortedColumns.size () > 1) {
                valueString = (valueString == null || valueString.isEmpty()) ?
                    Integer.toString(sortRank) :
                    sortRank+" "+valueString;
            }
            // don't use deriveFont() - see #49973 for details
            label.setFont (new Font (label.getFont ().getName (), Font.BOLD, label.getFont ().getSize ()));

            if (ascending) {
                sortIcon = UIManager.getIcon("ETableHeader.ascendingIcon");
                if (sortIcon == null) {
                    sortIcon = new SortUpIcon();
                }
            } else {
                sortIcon = UIManager.getIcon("ETableHeader.descendingIcon");
                if (sortIcon == null) {
                    sortIcon = new SortDownIcon();
                }
            }
        }
        label.setText(valueString);
        if (sortIcon == null) {
            label.setIcon(customIcon);
        } else {
            if (customIcon == null) {
                label.setIcon(sortIcon);
            } else {
                label.setIcon(mergeIcons(customIcon, sortIcon, 16, 0, label));
            }
        }
    }
    return resUI;
}
 
Example 18
Source File: ImageRGBEditor.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
private static void findImageUseImpl(com.codename1.ui.Image resourceValue, Vector users, EditableResources res, JLabel borderPreview) {
    for(String themeName : res.getThemeResourceNames()) {
        Hashtable theme = res.getTheme(themeName);
        for(Object key : theme.keySet()) {
            Object value = theme.get(key);
            if(value instanceof com.codename1.ui.Image) {
                if(value.equals(resourceValue)) {
                    addToUsers((String)key, users);
                }
            }
            if(value instanceof Border) {
                Border b = (Border)value;
                // BORDER_TYPE_IMAGE
                if(Accessor.getType(b) == Accessor.TYPE_IMAGE || Accessor.getType(b) == Accessor.TYPE_IMAGE_HORIZONTAL ||
                        Accessor.getType(b) == Accessor.TYPE_IMAGE_VERTICAL) {
                    com.codename1.ui.Image[] images = Accessor.getImages(b);
                    for(int i = 0 ; i < images.length ; i++) {
                        if(images[i] == resourceValue) {
                            addToUsers((String)key, users);
                            if(borderPreview != null && borderPreview.getIcon() == null) {
                                int borderWidth = Math.max(100, b.getMinimumWidth());
                                int borderHeight = Math.max(100, b.getMinimumHeight());
                                com.codename1.ui.Image img = com.codename1.ui.Image.createImage(borderWidth, borderHeight);
                                com.codename1.ui.Label l = new com.codename1.ui.Label("Preview");
                                l.getStyle().setBorder(b);
                                l.setSize(new com.codename1.ui.geom.Dimension(borderWidth, borderHeight));
                                l.paintComponent(img.getGraphics());
                                CodenameOneImageIcon icon = new CodenameOneImageIcon(img, borderWidth, borderHeight);
                                borderPreview.setIcon(icon);
                            }
                        }
                    }
                }
            }
        }
    }
    // check if a timeline is making use of said image and replace it
    for(String image : res.getImageResourceNames()) {
        com.codename1.ui.Image current = res.getImage(image);
        if(current instanceof com.codename1.ui.animations.Timeline) {
            com.codename1.ui.animations.Timeline time = (com.codename1.ui.animations.Timeline)current;
            for(int iter = 0 ; iter < time.getAnimationCount() ; iter++) {
                com.codename1.ui.animations.AnimationObject o = time.getAnimation(iter);
                if(AnimationAccessor.getImage(o) == resourceValue) {
                    addToUsers(image, users);
                }
            }
        }
    }

    // check if a UI resource is making use of the image
    UIBuilderOverride builder = new UIBuilderOverride();
    for(String uiResource : res.getUIResourceNames()) {
        com.codename1.ui.Container c = builder.createContainer(res, uiResource);
        if(ResourceEditorView.findImageInContainer(c, resourceValue)) {
            addToUsers(uiResource, users);
        }
    }
}
 
Example 19
Source File: RepositoryFormPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void initComponents() {
    cardsPanel = new JPanel(new CardLayout());

    errorLabel = new JLabel();
    errorLabel.setForeground(ERROR_COLOR);
    errorLabel.setIcon(new ImageIcon(ImageUtilities.loadImage(
            "org/netbeans/modules/bugtracking/ui/resources/error.gif")));   //NOI18N
    errorText = new JTextArea();
    errorText.setForeground(ERROR_COLOR);
    errorText.setBackground(errorLabel.getBackground());
    errorText.setEditable(false);
    
    errorScrollPane = new javax.swing.JScrollPane();
    errorScrollPane.setBorder(null);
    errorScrollPane.setViewportView(errorText);
    
    updateErrorMessage(" ");                                        //NOI18N
    
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    
    int height = errorText.getFont().getSize() * 3;
    
    layout.setHorizontalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createSequentialGroup()
                    .addComponent(errorLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(errorScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 0, Short.MAX_VALUE)))
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(cardsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGap(6, 14, 14)
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(errorScrollPane, height, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(errorLabel))
            )
    );
    layout.setHonorsVisibility(false);  //keep space for errorLabel
}
 
Example 20
Source File: JreForm.java    From jmkvpropedit with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public JPanel createPanel1()
{
   JPanel jpanel1 = new JPanel();
   FormLayout formlayout1 = new FormLayout("RIGHT:MAX(65DLU;DEFAULT):NONE,FILL:3DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE","CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE");
   CellConstraints cc = new CellConstraints();
   jpanel1.setLayout(formlayout1);

   _varCombo.setName("varCombo");
   jpanel1.add(_varCombo,cc.xy(3,1));

   _propertyButton.setActionCommand("Add");
   _propertyButton.setIcon(loadImage("images/edit_add16.png"));
   _propertyButton.setName("propertyButton");
   _propertyButton.setText(Messages.getString("property"));
   _propertyButton.setToolTipText(Messages.getString("propertyTip"));
   jpanel1.add(_propertyButton,cc.xy(5,1));

   _optionButton.setActionCommand("Add");
   _optionButton.setIcon(loadImage("images/edit_add16.png"));
   _optionButton.setName("optionButton");
   _optionButton.setText(Messages.getString("option"));
   _optionButton.setToolTipText(Messages.getString("optionTip"));
   jpanel1.add(_optionButton,cc.xy(7,1));

   _envPropertyButton.setActionCommand("Add");
   _envPropertyButton.setIcon(loadImage("images/edit_add16.png"));
   _envPropertyButton.setName("envPropertyButton");
   _envPropertyButton.setText(Messages.getString("property"));
   _envPropertyButton.setToolTipText(Messages.getString("propertyTip"));
   jpanel1.add(_envPropertyButton,cc.xy(5,3));

   JLabel jlabel1 = new JLabel();
   jlabel1.setText(Messages.getString("varsAndRegistry"));
   jpanel1.add(jlabel1,cc.xy(1,1));

   JLabel jlabel2 = new JLabel();
   jlabel2.setIcon(loadImage("images/asterix.gif"));
   jlabel2.setText(Messages.getString("envVar"));
   jpanel1.add(jlabel2,cc.xy(1,3));

   _envOptionButton.setActionCommand("Add");
   _envOptionButton.setIcon(loadImage("images/edit_add16.png"));
   _envOptionButton.setName("envOptionButton");
   _envOptionButton.setText(Messages.getString("option"));
   _envOptionButton.setToolTipText(Messages.getString("optionTip"));
   jpanel1.add(_envOptionButton,cc.xy(7,3));

   _envVarField.setName("envVarField");
   jpanel1.add(_envVarField,cc.xy(3,3));

   addFillComponents(jpanel1,new int[]{ 2,4,6 },new int[]{ 2 });
   return jpanel1;
}