Click to See Complete Forum and Search --> : joptionpane
hi all
I am trying to display an optionpane thats displays error messages to users.
It displays fine but it messes up the display of the jframe that calls it.
In others words it displays infront of the calling frame and that frame just looks very odd.
I have tried using SwingUtilities.updateComponentTreeUI(this);
but this doesnt seem to work.
any ideas?
thanks
ArchAngel
07-18-2003, 08:59 AM
"In others words it displays infront of the calling frame and that frame just looks very odd."
Huh? What do you mean "odd"? Can you post a screenshot?
I certainly can---
dialog is (obviosuly)the optionpane im popping up. Frame is what the calling frame looks like when the optionpane pops up.
Cheers
ArchAngel
07-18-2003, 09:09 AM
That's pretty screwed up. Can you post your code?
ok this is the optionpane code-
import javax.swing.JOptionPane;
import javax.swing.JDialog;
import javax.swing.JTextField;
import java.beans.*; //Property change stuff
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class dialog_error extends JPanel{
JFrame fram;
Font font1;
JOptionPane j;
public dialog_error()
{fram =new JFrame();
font1=(new Font("Monospaced",Font.ITALIC+Font.BOLD,30));
this.setFont(font1);
j=new JOptionPane();
j.setFont(new Font("Monospaced",Font.ITALIC+Font.BOLD,30));
j.setSize(1500,500);
j.showMessageDialog(null,"No Indexes available,Please Select another object",
"Which Functor Error", JOptionPane.ERROR_MESSAGE);
SwingUtilities.updateComponentTreeUI(j);
}
}
This is where I call the optionpane...this method is comes from a class that extends JFrame(if that makes any difference).
try{
long start;
long end;
ol= index.getObservations(index.getMinIndex(),index.getMaxIndex());
} catch (Exception e){
dialog_error d=new dialog_error();
d.setVisible(true);
d.revalidate();
SwingUtilities.updateComponentTreeUI(this);
repaint();
}
Cheers
devx.com
Copyright Internet.com Inc. All Rights Reserved