Dimension dim = new Dimension(300,200);
jLabel1.setPreferredSize(dim);
jLabel1.setMinimumSize(dim);
jLabel1.getParent().revalidate();
Reset:
jLabel1.setPreferredSize(null);
jLabel1.setMinimumSize(null);
jLabel1.getParent().revalidate();
Note:
The specifics of which "size" method to use depends on the layout of the Parent
jLabel1.setFont(new Font("Courier New", Font.BOLD | Font.ITALIC, 23));
Reset:
jLabel1.setFont(null);
jLabel1.setForeground(Color.GREEN);
Reset:
jLabel1.setForeground(null);
jLabel1.setOpaque(true);
jLabel1.setBackground(Color.RED);
Reset:
jLabel1.setBackground(null);
jLabel1.setBorder(new LineBorder(Color.MAGENTA, 4));
Reset:
jLabel1.setBorder(null);
Set Text and Icon Gap
jLabel1.setIconTextGap(40);
Reset:
jLabel1.setIconTextGap(4);