Hi,
please copy and run the following code, GUI 'll show u a combo , button and a painted rectengle. when u select combo it runs fine but when u click button and then select cobmo it repaints the rectengle with background.
Could any one of u help me to stoping it.
**********************************************************
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import javax.swing.plaf.*;
public class SACR008 extends JApplet
{
private final String[] marrstrMonth = {
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October",
"November", "December"
};
private JComboBox cmbMonth = new JComboBox(marrstrMonth);
private JButton btn = new JButton("Click ME");
public void init()
{
// This line prevents the "Swing:
//checked access to system event queue" message seen in some browsers.
getRootPane().putClientProperty( "defeatSystemEventQueueCheck",
Boolean.TRUE
);
Container objContainer = getContentPane();
objContainer.setLayout(null);
objContainer.setBackground(new java.awt.Color(134,173,202));
objContainer.setFont(new Font("Serif", Font.PLAIN, 12));
objContainer.add(cmbMonth);
cmbMonth.setFont(new Font("Serif", Font.PLAIN, 12));
cmbMonth.setBounds(50,50,80,22);
//cmbMonth.addMouseListener(new MouseHandler());
objContainer.add(btn);
btn.setBounds(140,50,80,22);
try {
UIManager.setLookAndFeel
("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} catch ( Exception exp ) {
// catch goes here
}
SwingUtilities.updateComponentTreeUI(this);
}
public void paint(Graphics aobjGraphics)
{
Graphics2D g2d = (Graphics2D)aobjGraphics;
super.paint(g2d);
if(cmbMonth.isPopupVisible())
{
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OVER));
}
else
{
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
}
g2d.setColor(Color.blue);
g2d.fill(new Rectangle(50,75,300,300));
}
}
**********************************************************
"Aim"
-
(Urgent!!!!)Problem with printing in swing (1 messages)
- Posted by: Amit Rathi
- Posted on: February 26 2002 08:59 EST
Threaded Messages (1)
- (Urgent!!!!)Problem with printing in swing by Tom Davies on February 26 2002 18:33 EST
-
(Urgent!!!!)Problem with printing in swing[ Go to top ]
- Posted by: Tom Davies
- Posted on: February 26 2002 18:33 EST
- in response to Amit Rathi
This is nothing to do with EJB -- try one of the comp.lang.java Usenet groups.
Tom