Note that there are some explanatory texts on larger screens.

plurals
  1. POButton doesn't display
    primarykey
    data
    text
    <p>I have a strange problem... </p> <p>I have a JFrame and added two JInternalFrame </p> <p>I have added a JPanel to one of the internal frames.</p> <p>I used a mouse listener to the jpanel and wrote a code 'like placing a device object(a class extendng jpanel ) when i release the mouse.</p> <p>The device image does display, but only after i move d internal frame or maximize it.. why is tat? </p> <p>The following code is the JPanel which is added to one of the Internal Frames...</p> <pre><code>public class Board extends JPanel implements MouseListener{ Device[] devices=new Device[10]; int X,Y,i=0; int j=10; Point p1,p2; ImageIcon icon; public Board() { setBackground(Color.WHITE); this.addMouseListener(this); setLayout(null); } public void mouseClicked(MouseEvent me){ } public void mouseExited(MouseEvent me){ } public void mouseEntered(MouseEvent me){ } public void mousePressed(MouseEvent me){ } public void mouseReleased(MouseEvent me){ X=me.getX(); Y=me.getY(); icon=new ImageIcon("E:\\java\\ecadpb\\src\\ecadpb\\device"+Layout1.clicked+".png"); devices[i].setBounds(X,Y,icon.getIconWidth(),icon.getIconHeight()+20); devices[i].setVisible(true); this.add(devices[i]); this.repaint(X,Y,icon.getIconWidth(),icon.getIconHeight()+20); i++; } } } </code></pre> <p>The following is the Device class.. </p> <pre><code>public Device(Point pos,JLabel label,Rectangle r,int input,int output){ setVisible(true); setBackground(Color.BLACK); deviceNo=dno; position=pos; inputs=input; outputs=output; this.r=r; label.setLayout(null); setOpaque(false); this.add(label); label.addMouseListener(this); dno++; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload