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

The following examples show how to use javax.swing.JLabel#repaint() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
public void updateBundleComp(Bundle b) {
  final JLabel c = (JLabel) getBundleComponent(b);

  if(c == null) {
    addBundle(new Bundle[]{b});
    return;
  }

  c.setToolTipText(Util.bundleInfo(b));

  final Icon icon = Util.getBundleIcon(b);

  c.setIcon(icon);

  c.invalidate();
  c.repaint();
  invalidate();
  repaint();
}
 
Example 2
public static void showSplash() {
	screen = new JWindow();
	final URL resource = MainFrame.class.getResource("mpcmaidlogo400_400.png");
	final JLabel label = new JLabel(new ImageIcon(resource));
	screen.getContentPane().add(label);
	screen.setLocationRelativeTo(null);
	Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
	Dimension labelSize = screen.getPreferredSize();
	screen
			.setLocation(screenSize.width / 2 - (labelSize.width / 2), screenSize.height / 2
					- (labelSize.height / 2));
	screen.pack();
	screen.setVisible(true);
	label.repaint();
	screen.repaint();
}
 
Example 3
void Inicie(ParteAjuda sel) {
        this.setTitle(sel.getTitulo());
        if (sel.getByteImage() != null || sel.getHtml() != null) {//.isEmpty()) {
            Pan.removeAll();
            int H = 0;
            int W = 0;
            if (!sel.getHtml().isEmpty()) {
                JLabel htmLbl = new JLabel();
                htmLbl.setText(sel.getHtml());
                htmLbl.repaint();
                Dimension d = htmLbl.getPreferredSize();
                int x = (getPreferredSize().width - d.width) / 2;
                if (getPreferredSize().width < d.width) {
                    x = 0;
                }
//                int y = (getPreferredSize().height - d.height - subPan.getPreferredSize().height) / 2;
//                if (getPreferredSize().height - subPan.getPreferredSize().height < d.height) {
//                    y = 0;
//                }
                htmLbl.setBounds(x, 0, d.width, d.height);
                //Pan.setBackground(Color.yellow);
                Pan.add(htmLbl);
                H = d.height + 10;
                W = d.width;
            }
            if (sel.getByteImage() != null) {
                ImageIcon img = new ImageIcon(sel.getByteImage());
                JLabel picLabel = new JLabel(img);
                W = W > img.getIconWidth() ? W : img.getIconWidth();
                picLabel.setBounds(0, H, img.getIconWidth(), img.getIconHeight());
                picLabel.setPreferredSize(new Dimension(img.getIconWidth(), img.getIconHeight()));
                H += img.getIconHeight();
                Pan.setPreferredSize(new Dimension(W, H));
                Pan.add(picLabel);
            }
            Pan.revalidate();
            Pan.repaint();
        }
    }
 
Example 4
public void run() {
    try {

        String temp_file = (mainFrame.Home + File.separator + "object.tmp");

        for (int i = 1; i != mainFrame.previous_objectarray_length; i++) {
            if (mainFrame.object_item[i] != null) {
                if (mainFrame.object_item[i].isSelected()) {
                    String new_object_name = mainFrame.convertObject(mainFrame.object_item[i].getText(), "download");
                    jTextArea1.setText("\n\nPlease wait, the image is loading.");
                    mainFrame.calibrateTextArea();
                    mainFrame.get = new Get(mainFrame.object_item[i].getText(), mainFrame.cred.access_key, mainFrame.cred.getSecret_key(), mainFrame.cred.getBucket(), mainFrame.cred.getEndpoint(), temp_file, null);
                    mainFrame.get.run();
                    BufferedImage imagee = ImageIO.read(new File(temp_file));
                    label = new JLabel(new ImageIcon(imagee));
                    label.revalidate();
                    label.validate();
                    label.repaint();
                    mainFrame.jPanel11.removeAll();
                    mainFrame.jPanel11.add(label);
                    mainFrame.jPanel11.repaint();
                    mainFrame.jPanel11.revalidate();
                    mainFrame.jPanel11.validate();
                    mainFrame.deleteFle(temp_file);
                    mainFrame.object_item[i].setSelected(false);
                    break;
                }
            }
        }
    } catch (Exception imageLoading) {
        jTextArea1.append("\n" + imageLoading.getMessage());
    }
    mainFrame.calibrateTextArea();

}