Image component « JInternalFrame « Java Swing Q&A





1. JInternalFrame Image display;    stackoverflow.com

I tried adding an image to JInternalFrame. my paint() looks like this:

    public void paint (Graphics g) {
        //this should draw ...

3. Problems with create[Volatile]Image in JInternalFrame    coderanch.com

I'm trying to create an MDI application with custom JInternalFrames, called MapFrames. Each MapFrame needs to have access to either a VolatileImage or just a plain Image for double buffering. Now, the problem is that everytime I call createImage or createVolatileImage, it returns a null pointer. I want the size of the [Volatile]Image to be as close to the same size ...

4. Image in JInternalFrame    coderanch.com

5. Refeshing image in JInternalFrame    java-forums.org

public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { Timer timer = new Timer(3000, new ActionListener() { public void actionPerformed(ActionEvent e) { String comp =(String)jComboBox1.getSelectedItem(); ImageIcon ii = new ImageIcon(comp+"resized.jpg"); JLabel lab = new JLabel(); lab.setIcon(ii); jInternalFrame1.setTitle(comp); org.jdesktop.layout.GroupLayout jInternalFrame1Layout = new org.jdesktop.layout.GroupLayout(jInternalFrame1.getContentPane()); jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); jInternalFrame1Layout.setHorizontalGroup( jInternalFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 300, Short.MAX_VALUE) .add(lab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 333, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ); jInternalFrame1Layout.setVerticalGroup( jInternalFrame1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) .add(0, 240, Short.MAX_VALUE) .add(lab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ); jInternalFrame1.setVisible(true); jInternalFrame1.revalidate(); ...

6. image on JInternalFrame    java-forums.org

class ImagePanel extends JPanel { //path of image private String path; //image object private Image img; public ImagePanel(String path) throws IOException { //save path this.path = path; //load image img = ImageIO.read(new File(path)); } //override paint method of panel public void paint(Graphics g) { //draw the image if( img != null) g.drawImage(img,0,0, this); } }