JDialog Problems

Hi everyone,
I'm developing an application which uses Swing Controls.
In particular i have the need to open a JColorChooser from a JFrame.
Everything works fine, but when i close the JColorChooser, the JFrame seems to be locked, it has the focus but it doesn't respond to any event, both keyboard and mouse.
The code is quite simple, on a JButton action, i open a JColorChooser specifying "this" as parent.
What coul this depend on?
thanks in advance
Lucadale

Sounds unusual... Can you post your code? It will enable us to give you a good answer.

Similar Messages

  • JDialog problem with 1.4.2_05?

    I've got a program that needs to stop processing and display a JDialog (or JFrame if easier) to gather user information. The problem I'm having seems to be in .setVisible(). It renders the window and the title bar, and never finishes rendering the guts of the JDialog. I've stripped it down to basically a "hello world" label, and it still doesn't disply. Can some one please help me with this? I'm totally stumped. I've seen posting and bug reports that sound similar, but they say a fix was coming in 1.4, and I'm using 1.4. Thanks in advance.

    The problem actually seems to be the combination of setModal(true) and setVisible(). If I remove the setModal, the screen renders properly, but processing continues.
    My outter class is a socket server that listens, and validates some data. It gets to this section :
    if (open == false) {
    DateScreen ds = new DateScreen();
    I need a valid date for this transaction. The DateScreen looks like :
    public class DateScreen extends JDialog implements ShipInterface/*, ActionListener*/ {
    private NumberFormat nto2a = NumberFormat.getInstance();
    private JDatePicker jdp = new JDatePicker();
    private Carrier carrier = null;
    public DateScreen() {
    this.setModal(true);
    nto2a.setMinimumIntegerDigits(2);
    nto2a.setGroupingUsed(false);
    int debug=0;
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    JPanel main = new JPanel();
    this.setContentPane(main);
    this.getContentPane().setLayout(new BoxLayout(main, BoxLayout.X_AXIS));
    jdp = new JDatePicker();
    jdp.setAutoCalendarPosition(true);
    Calendar cal = Calendar.getInstance();
    try {
    jdp.setMinDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DATE));
    } catch (JDatePickerException e) {
    e.printStackTrace();
    this.getContentPane().add(Box.createHorizontalStrut(10));
    this.getContentPane().add(jdp);
    JButton jb = new JButton("Continue");
    jb.setActionCommand("date_continue");
    this.getContentPane().add(Box.createHorizontalStrut(5));
    this.getContentPane().add(jb);
    this.getContentPane().add(Box.createHorizontalStrut(10));
    this.pack();
    this.setVisible(true);
    }

  • JDialog Problem: How to make a simple "About" dialog box?

    Hi, anyone can try me out the problem, how to make a simple "About" dialog box? I try to click on the MenuBar item, then request it display a JDialog, how? Following is my example code, what wrong code inside?
    ** Main.java**
    ============================
    publc class Main extends JFrame{
    public Main() {
              super();
              setJMenuBar();
              initialize();
    public void setJMenuBar()
         JMenuBar menubar = new JMenuBar();
            setJMenuBar(menubar);
            JMenu menu1 = new JMenu("File");      
            JMenuItem item = new JMenuItem("About");      
            item.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent ae) {
                  // About about = new About(this);
               // about.show();
            menu1.add(item);
         menubar.add(menu1);
    public static void main(String args[]){
         Main main = new Main();
    }** About.java**
    =============================
    import java.awt.*;
    import javax.swing.*;
    public class About extends JDialog{
         JPanel jp_top, jp_center, jp_bottom;
         public About(JFrame owner){
              super(owner);
              setDefaultCloseOperation( DISPOSE_ON_CLOSE );
              Image img = Toolkit.getDefaultToolkit().getImage(DateChooser.class.getResource("Duke.gif"));          
              setIconImage( img );
              setSize(500,800);
              Container contentPane = getContentPane();
             contentPane.setLayout(new BorderLayout());           
             contentPane.add(getTop(), BorderLayout.NORTH);
              contentPane.add(getCenter(), BorderLayout.CENTER);
              contentPane.add(getBottom(), BorderLayout.SOUTH);
              setResizable(false);
               pack();            
               setVisible(true);
         public JPanel getTop(){
              jp_top = new JPanel();
              return jp_top;
         public JPanel getCenter(){
              jp_center = new JPanel();
              return jp_center;
         public JPanel getBottom(){
              jp_bottom = new JPanel();
              jp_bottom.setLayout(new BoxLayout(jp_bottom, BoxLayout.X_AXIS));
              JButton jb = new JButton("OK");
              jp_bottom.add(jb);
              return jp_bottom;
    }

    Code looks reasonable except
    a) the code in the actionPerformed is commment out
    b) the owner of the dialog should be the frame
    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)",
    see http://homepage1.nifty.com/algafield/sscce.html,
    that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

  • JDialog Problem

    When ever i set resize of JDialog is false ,the image idisappears. Plz help me
    Advanced thanx to all
    Susi

    Ahem... It's amazing that you haven't posted a minimal example program that demonstrates your problem.

  • JDialogs Problem

    I have an Application, which loads a JDialog.
    how would i close the dialoge (through the class running in the dialog) and create a new dialoge belonging to the application frame?
    here is the code for creating the dialogs
        if (e.getSource() == newGame) {
           JDialog quiz = new JDialog(this, "Who Wants to be a Millionaire?" , true);
           //quiz.setDefaultLookAndFeelDecorated(true);
           Millionaire million = new Millionaire();
           quiz.getContentPane().add(million);
           quiz.pack();
           quiz.show();
        else if (e.getSource() == highScore) {
            JDialog HighScore = new JDialog(this, "High Scores" , true);
            //HighScore.setDefaultLookAndFeelDecorated(true);
            HighScore score = new HighScore();
            HighScore.getContentPane().add(score);
            HighScore.pack();
            HighScore.show();
        }the Quiz dialoge is not always going to use the highScore one, so should i call the high score diologe from the quiz one?

    not sure what you're trying to do, but try this
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class MainApp extends JFrame implements ActionListener
      JDialog quiz, highScore;
      JButton newGame,highScoreBtn;
      MainApp mainApp;
      public MainApp()
        mainApp = this;
        setLocation(400,300);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
        JPanel main = new JPanel();
        newGame = new JButton("New Game");
        highScoreBtn = new JButton("High Scores");
        newGame.addActionListener(this);
        highScoreBtn.addActionListener(this);
        main.add(highScoreBtn);
        main.add(newGame);
        getContentPane().add(main);
        pack();
      public void actionPerformed(ActionEvent e)
        if (e.getSource() == newGame)
          quiz = new JDialog(this, "Who Wants to be a Millionaire?" , true);
          Millionaire million = new Millionaire();
          quiz.setLocation(400,300);
          quiz.getContentPane().add(million);
          quiz.pack();
          mainApp.setVisible(false);
          quiz.show();
        else if(e.getSource() == highScoreBtn) highScores();
      public void highScores()
        highScore = new JDialog(this, "High Scores" , true);
        HighScore score = new HighScore();
        highScore.setLocation(400,300);
        highScore.getContentPane().add(score);
        highScore.pack();
        mainApp.setVisible(false);
        highScore.show();
      class Millionaire extends JPanel
        public Millionaire()
          setLayout(new GridLayout(2,1));
          JButton btn = new JButton("OK");
          btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
              quiz.setVisible(false);
              highScores();
              quiz.dispose();}});
          add(new JLabel("Millionaire panel"));
          add(btn);
      class HighScore extends JPanel
        public HighScore()
          setLayout(new GridLayout(2,1));
          JButton btn = new JButton("OK");
          btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent e){
              mainApp.setVisible(true);
              highScore.dispose();}});
          add(new JLabel("High score panel"));
          add(btn);
      public static void main(String[] args){new MainApp().setVisible(true);}
    }

  • JDialog woes, has anyone solved these yet?

    I can't seem to find a solution to the following two JDialog problems. They seem to have existed for a few years, but I can't find a solution.
    1. Any JDialog windows that I use doesn't take the icon of it's parent frame. Just a cosmetic thing, but I would like to fix it.
    2. Much more serious is the old problem of Alt+Tabbing back to the application when a JDialog is being used. The JDialog appears behind the main application frame, so essentially the program is locked. I can't send out the app until I've fixed this one.
    Can anyone help, I'm using 1.4.2.
    Thanks

    Hi!
    If you want to see the frame-icon in your dialog, you have to make the dialog resizeable. None-resizeable Windows-dialogs do not have a frame icon. I suppose it has something to do with the Windows-native peer, since non-resizeable dialogs do not have a frame-icon in Windows-applications as well (e.g. Outlook's "Options" dialog).
    Here is the code I used to verify the alt-tab-problem:
    public class MainFrame extends JFrame {
         public MainFrame() {
              JButton btn1 = new JButton("About");
              btn1.addActionListener(new ActionListener() {
                    * Invoked when an action occurs.
                   public void actionPerformed(ActionEvent e) {
                        helpAbout dlgAbout = new helpAbout(MainFrame.this);
                        dlgAbout.show();
              JButton btn2 = new JButton("Exit");
              btn2.addActionListener(new ActionListener() {
                    * Invoked when an action occurs.
                   public void actionPerformed(ActionEvent e) {
                        System.exit(0);
              getContentPane().setLayout(new FlowLayout());
              getContentPane().add(btn1);
              getContentPane().add(btn2);
              pack();
         public class helpAbout extends JDialog implements ActionListener
              JButton cmdOK = new JButton("OK");
              public helpAbout(JFrame parent) {
                   // Show a dialog box to select a location
                   super(parent, "About", true);
                   setSize(360, 130);
                   setResizable(false);
                   setModal(true);
                   getContentPane().add(cmdOK);
                   cmdOK.addActionListener(this);
                   setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
               * Invoked when an action occurs.
              public void actionPerformed(ActionEvent e) {
                   dispose();
         public static void main(String[] args) {
              MainFrame frame = new MainFrame();
              frame.show();
    }When I start this as an application, running jre1.4.2_09 (java -cp . MainFrame) , I have no Problem with the alt-tab. I always see both the MainFrame and the About-dialog (Windows2000).
    Do you have a problem with an application or with an applet?

  • Problem with jDialog in a JFrame

    Hello to everyone...i'm newby java GUI developer, and i've got a problem with a JDialog within a JFrame...
    I made a JFrame which creates a new customized JDialog in his contructor, like this:
    MioJdialog dlg = new MioJdialog(this, true);
    dlg.setVisible(true);
    ...The "MioJdialog" class store his JFrame parent under a private attribute, in this way:
    class MioJdialog {...
    private Frame parent;
    public MioJdialog (Frame parent, boolean modal){
        this.parent=parent;
    ....}and here's the problem: when i try to close the parent JFrame with a command like this:
    parent.dispose();
    ( in order to close the whole window), sometimes happens that the JFrame is still visible on the screen...and i don't know why...
    got some hints?
    thanks to everyone!
    Edited by: akyra on Jan 14, 2008 4:36 AM
    Edited by: akyra on Jan 14, 2008 4:37 AM
    Edited by: akyra on Jan 14, 2008 4:37 AM

    If you need further help then you need to create a "Short, Self Contained, Compilable and Executable, Example Program (SSCCE)", that demonstrates the incorrect behaviour.
    http://homepage1.nifty.com/algafield/sscce.html
    Don't forget to use the "Code Formatting Tags", so the posted code retains its original formatting.
    http://forum.java.sun.com/help.jspa?sec=formatting

  • Problem with JDialogs and Threads

    Hi. I'm new to this forum and I hope I'm not asking a repeat question. I didn't find what I needed after a quick search of existing topics.
    I have this problem with creating a new JDialog from within a thread. I have a class which extends JDialog and within it I'm running a thread which calls up another JDialog. My problem is that the JDialog created by the Thread does not seem to function. Everything is unclickable except for the buttons in the titlebar. Is there something that I'm missing out on?

    yeah, bad idea, don't do that.

  • Problem with JDialogs

    Hi All,
    I have a problem with JDialogs in my standalone application. This app pops-up multiple JDialogs, say a stack of JDialogs.
    I have a standalone application which runs as a JFrame, call it JFrame1, which is working fine. JFrame1 pops-up a JDialog, on some button click on JFrame1, call it JDialog1, which is also working fine. Now JDialog1 pops-up another JDialog, again on some button click on JDialog1, call it JDialog2, which is too working fine. But, after I finish with JDialog2 and dispose it my JDialog1 is not working fine, though that is the front dialog at present.
    Any ideas why JDialog1 is not working fine? Am I missing anything?
    Thanks,
    Srinivas.

    Hi,
    I have a component called DateComponent that works similar to a JComboBox. When you click a small button of DateComponent, it pops-up a Calendar similar to the drop down list of JComboBox and user can pick a date from it. It gets closed when it loses focus.
    I have this DateComponent on JFrame1, JDialog1 and JDialog2. The Calendar is not being diaplayed on JDialog1 upon clicking the small button of DateComponent after JDialog2 is disposed. But it is being diaplayed properly on JDialog1 before JDialog1 opens JDialog2. What could be wrong?
    I am using JDK1.3.1.
    Thanks,
    Srinivas.

  • Problem with refreshing JFrames and JDialogs

    My program is based on few JDialogs and one JFrame. I'm still changing them, one time one of the JDialogs is visible, other time JFrame. During this change I call dispose() for one window or frame and I create (if it wasn't created before) other component and call setVisible(true) for it. Problem is that sometimes (only sometimes! like 5% of calls) my windows appears but they are not refreshing (not showing new objects added to their lists or sth like that) until I resize my window by dragging mouse on the edge of it. Is there anyway to ensure that window will be displayed properly?

    I ran into this problem about a year ago...so I don't really remember but I think a call to validate(), or paint() or repaint() or something like that should do the trick (forgive me for not knowing the exact one but as I said it has been a while). Its been about that year since I stopped coding in java and moved to c#. You want the window to redraw its self what ever that is.

  • Problem with a template method in JDialog

    Hi friends,
    I'm experiencing a problem with JDialog. I have a base abstract class ChooseLocationDialog<E> to let a client choose a location for database. This is an abstract class with two abstract methods:
    protected abstract E prepareLocation();
    protected abstract JPanel prepareForm();Method prepareForm is used in the constructor of ChooseLocationDialog to get a JPanel and add it to content pane.
    Method prepareLocation is used to prepare location of a database. I have to options - local file and networking.
    There are two subclasses ChooseRemoteLocationDialog and ChooseLocalFileDialog.
    When I start a local version, ChooseLocalFileDialog with one input field for local file, everything works fine and my local client version starts execution.
    The problem arises when I start a network version of my client. Dialog appears and I can enter host and port into the input fields. But when I click Select, I get NullPointerException. During debugging I noticed that the values I entered into these fields ("localhost" for host and "10999" for port) were not set for corresponding JTextFields and when my code executes getText() method for these input fields it returns empty strings. This happens only for one of these dialogs - for the ChooseRemoteLocationDialog.
    The code for ChooseLocationDialog class:
    public abstract class ChooseLocationDialog<E> extends JDialog {
         private E databaseLocation;
         private static final long serialVersionUID = -1630416811077468527L;
         public ChooseLocationDialog() {
              setTitle("Choose database location");
              setAlwaysOnTop(true);
              setModal(true);
              Container container = getContentPane();
              JPanel mainPanel = new JPanel();
              //retrieving a form of a concrete implementation
              JPanel formPanel = prepareForm();
              mainPanel.add(formPanel, BorderLayout.CENTER);
              JPanel buttonPanel = new JPanel(new GridLayout(1, 2));
              JButton okButton = new JButton(new SelectLocationAction());
              JButton cancelButton = new JButton(new CancelSelectAction());
              buttonPanel.add(okButton);
              buttonPanel.add(cancelButton);
              mainPanel.add(buttonPanel, BorderLayout.SOUTH);
              container.add(mainPanel);
              pack();
              Toolkit toolkit = Toolkit.getDefaultToolkit();
              Dimension screenSize = toolkit.getScreenSize();
              int x = (screenSize.width - getWidth()) / 2;
              int y = (screenSize.height - getHeight()) / 2;
              setLocation(x, y);
              addWindowListener(new WindowAdapter() {
                   @Override
                   public void windowClosing(WindowEvent e) {
                        super.windowClosing(e);
                        System.exit(0);
         public E getDatabaseLocation() {
                return databaseLocation;
         protected abstract E prepareLocation();
         protected abstract JPanel prepareForm();
          * Action for selecting location.
          * @author spyboost
         private class SelectLocationAction extends AbstractAction {
              private static final long serialVersionUID = 6242940810223013690L;
              public SelectLocationAction() {
                   putValue(Action.NAME, "Select");
              @Override
              public void actionPerformed(ActionEvent e) {
                   databaseLocation = prepareLocation();
                   setVisible(false);
         private class CancelSelectAction extends AbstractAction {
              private static final long serialVersionUID = -1025433106273231228L;
              public CancelSelectAction() {
                   putValue(Action.NAME, "Cancel");
              @Override
              public void actionPerformed(ActionEvent e) {
                   System.exit(0);
    }Code for ChooseLocalFileDialog
    public class ChooseLocalFileDialog extends ChooseLocationDialog<String> {
         private JTextField fileTextField;
         private static final long serialVersionUID = 2232230394481975840L;
         @Override
         protected JPanel prepareForm() {
              JPanel panel = new JPanel();
              panel.add(new JLabel("File"));
              fileTextField = new JTextField(15);
              panel.add(fileTextField);
              return panel;
         @Override
         protected String prepareLocation() {
              String location = fileTextField.getText();
              return location;
    }Code for ChooseRemoteLocationDialog
    public class ChooseRemoteLocationDialog extends
              ChooseLocationDialog<RemoteLocation> {
         private JTextField hostField;
         private JTextField portField;
         private static final long serialVersionUID = -2282249521568378092L;
         @Override
         protected JPanel prepareForm() {
              JPanel panel = new JPanel(new GridLayout(2, 2));
              panel.add(new JLabel("Host"));
              hostField = new JTextField(15);
              panel.add(hostField);
              panel.add(new JLabel("Port"));
              portField = new JTextField(15);
              panel.add(portField);
              return panel;
         @Override
         protected RemoteLocation prepareLocation() {
              String host = hostField.getText();
              int port = 0;
              try {
                   String portText = portField.getText();
                   port = Integer.getInteger(portText);
              } catch (NumberFormatException e) {
                   e.printStackTrace();
              RemoteLocation location = new RemoteLocation(host, port);
              return location;
    }Code for RemoteLocation:
    public class RemoteLocation {
         private String host;
         private int port;
         public RemoteLocation() {
              super();
         public RemoteLocation(String host, int port) {
              super();
              this.host = host;
              this.port = port;
         public String getHost() {
              return host;
         public void setHost(String host) {
              this.host = host;
         public int getPort() {
              return port;
         public void setPort(int port) {
              this.port = port;
    }Code snippet for dialog usage in local client implementation:
    final ChooseLocationDialog<String> dialog = new ChooseLocalFileDialog();
    dialog.setVisible(true);
    location = dialog.getDatabaseLocation();
    String filePath = location;Code snippet for dialog usage in network client implementation:
    final ChooseLocationDialog<RemoteLocation> dialog = new ChooseRemoteLocationDialog();
    dialog.setVisible(true);
    RemoteLocation location = dialog.getDatabaseLocation();Exception that I'm getting:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at suncertify.client.gui.dialog.ChooseRemoteLocationDialog.prepareLocation(ChooseRemoteLocationDialog.java:42)
         at suncertify.client.gui.dialog.ChooseRemoteLocationDialog.prepareLocation(ChooseRemoteLocationDialog.java:1)
         at suncertify.client.gui.dialog.ChooseLocationDialog$SelectLocationAction.actionPerformed(ChooseLocationDialog.java:87)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6134)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
         at java.awt.Component.processEvent(Component.java:5899)
         at java.awt.Container.processEvent(Container.java:2023)
         at java.awt.Component.dispatchEventImpl(Component.java:4501)
         at java.awt.Container.dispatchEventImpl(Container.java:2081)
         at java.awt.Component.dispatchEvent(Component.java:4331)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4301)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3965)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3895)
         at java.awt.Container.dispatchEventImpl(Container.java:2067)
         at java.awt.Window.dispatchEventImpl(Window.java:2458)
         at java.awt.Component.dispatchEvent(Component.java:4331)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
         at java.awt.Dialog$1.run(Dialog.java:1046)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)java version "1.6.0"
    OpenJDK Runtime Environment (build 1.6.0-b09)
    OpenJDK Client VM (build 1.6.0-b09, mixed mode, sharing)
    OS: Ubuntu 8.04
    Appreciate any help.
    Thanks.
    Edited by: spyboost on Jul 24, 2008 5:38 PM

    What a silly error! I have to call Integer.parseInt instead of getInt. Integer.getInt tries to find a system property. A small misprint, but a huge amount of time to debug. I always use parseInt method and couldn't even notice that silly misprint. Sometimes it's useful to see the trees instead of whole forest :)
    It works perfectly. Sorry for disturbing.

  • Problem when a JPanel with a JDialog regains focus

    I've a simple application with a JFrame and a nested JDialog under MS Windows. When it regains focus (i.e. another application like MSWord was active and with Alt+Tab or with a mouse-click in taskbar I force my application to gain focus), the JDialog becomes active but I can't see the JPanel because between the dialog and the panel there is MSWord. In z-order I've get the dialog at top, under it MSWord and the panel at background. That's not the regular behavior, but sometimes it happens. Any idea to avoid always this behavior?
    Thanks in advance.

    Any solutions to this problem???

  • Problem resizing the JDialog???

    hi,
    I have a JDialog to which I am adding a JTable and JButton to search.
    Based on search condition the table gets populated.
    Problem here is
    I give search condition 1 and puplate the table after that I resize the JDialog
    Now i again serach it.Now the JDialog's size goes to the previous thing it does'nt take the resized size.
    in the end of my seacrh action listner I am doing
    this.pack();
    this.setVisible(true);
    this.setResizable(true);While running in debug mode I noticed once it execute this.pack();
    the resizing is gone.but if I remove this.pack() the JTable is not shown...
    Any idea about this problem??
    thnx
    neel

    The pack() method lays it out according to the preferred size of the content.
    You need to either only pack it when you first create it, or note the actual size before packing and if it's non-null and non-zero then restore it after packing.

  • Swing problem: table is not refreshed when i open it  from jdialog

    Hi , my situation is this one :
    1. i have a swing form.
    2. i have created a panel form where i have a drop down list and a table. wich are depndend with each other. When i choose an item to the drop down list the value in the table is changed.
    3. i invoke this panel into the form with drag and drop, with invoke jDialog from button option.
    4. First time i run the form and open the panel from button the drop down list and the table are working correctly.
    5. i close the panel and open it again: And at this time when i choose an item from drop down list the table is not refreshed anymore. I have to run the form again if i want that this panel to work correctly.
    Am i doing smth wrong? I dont have too much experience in swing , and the documentation for adf-swign are really poor .
    Ps: Maybe i should explain the way i have created the drop down list and table in the panel . i am not using smth like execute with parameters for the view in the table. I have created a link between the view in the drop down list and the view in the table. It seems they work correcly if i run the panel for the first time.
    Thanks in advance !

    To answer your question, Restore the iPhone with current iTunes on your computer. If fixed, it was software. If still problem, most likely hardware, and then make Genius reservation or set up Service and take or send to Apple for resolution under Warranty.

  • When we create JDialog inside Thread's run() method it is creating problem

    I have application that has feature that mainframe will be locked after three minutes and the time when it is locked it will show other locked dialog.
    Now my problem is given below:
    I have created one Dialog inside Threads run() method and this thread will execute when mainframe is locked.So what is happening is when mainframe is locked internally Thread is doing its job (its job is to display one dialog) and it is displaying dialog but mainframe is locked and still it is showing that dialog.This should not happen in our application when mainframe is locked nothing should come outside.
    simple code sample is given below:
    SwingUtilities.invokeLater(new Runnable()
    JDailog dlg = new JDialog();
    dlg.pack();
    dlg.show();
    Now when my applications mainframe is locked and thread is doing its job when mainframe is locked and it will show one dialog when its run() method will execute and it showing dialog even though mainframe is locked.This is major issue for me.please help me.
    sample code may contain compile errror but this only to give understanding what i am doing actually i cant show my original code.
    But show me some work around for this problem.Why dialog is coming outside when mainframe is locked?
    Please help me.I cant use delay inside run() method because of performance.
    Is there any way to control this behaviour?

    public class BackGroundThread extends javax.swing.JFrame implements BackgroundTaskInf {
        boolean isMainWindowActive = false;
        /** Creates new form BackGroundThread */
        public BackGroundThread() {
            initComponents();
            new DBBackgroudProcess(this).start();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            jDialog1 = new javax.swing.JDialog();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jLabel1.setText("JOB DONE");
            javax.swing.GroupLayout jDialog1Layout = new javax.swing.GroupLayout(jDialog1.getContentPane());
            jDialog1.getContentPane().setLayout(jDialog1Layout);
            jDialog1Layout.setHorizontalGroup(
                jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDialog1Layout.createSequentialGroup()
                    .addGap(95, 95, 95)
                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(240, Short.MAX_VALUE))
            jDialog1Layout.setVerticalGroup(
                jDialog1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jDialog1Layout.createSequentialGroup()
                    .addGap(22, 22, 22)
                    .addComponent(jLabel1)
                    .addContainerGap(22, Short.MAX_VALUE))
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            jLabel2.setText("Background work in progess");
            jButton1.setText("unlock");
            jButton1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jButton1ActionPerformed(evt);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(56, 56, 56)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 218, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(126, Short.MAX_VALUE))
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(263, Short.MAX_VALUE)
                    .addComponent(jButton1)
                    .addGap(74, 74, 74))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(40, 40, 40)
                    .addComponent(jLabel2)
                    .addGap(37, 37, 37)
                    .addComponent(jButton1)
                    .addContainerGap(43, Short.MAX_VALUE))
            pack();
        }// </editor-fold>                       
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
            isMainWindowActive = true;
            backgroundTaskFinished();
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new BackGroundThread().setVisible(true);
        public void backgroundTaskFinished(){
            if(isMainWindowActive) {
                jDialog1.setSize(200,200);
                jDialog1.setVisible(true);
                jLabel2.setText("Task is finished");
        // Variables declaration - do not modify                    
        private javax.swing.JButton jButton1;
        private javax.swing.JDialog jDialog1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        // End of variables declaration                  
    class DBBackgroudProcess extends Thread {
        BackgroundTaskInf infObj;
        public DBBackgroudProcess(BackgroundTaskInf infObj){
            this.infObj = infObj;
        public void run(){
            try{
                // here you can do your backgroudn task
                System.out.println("In BackGroud task");
                Thread.sleep(1000);
                System.out.println("task completed");
                infObj.backgroundTaskFinished();
            }catch(Exception e){
                e.printStackTrace();
    interface BackgroundTaskInf{
        public void backgroundTaskFinished();
    }

Maybe you are looking for

  • Did you know? Events on Operations -- Att: Sunil Gupta

    Did you know: One can drag an event to onto some services (and there will appear inthe top right of the operation an event circule)  The Goal: So Im wanting to know a bit more about this and what scenarios are intended with this type of functionality

  • EXC_BAD_ACCESS KERN_PROTECTION_FAILURE messages in Dreamweaver

    I know this theme has been posted a billion times, but the problem solving steps are so varied, I'm posting my question hoping to get help or at least a direction to the best topic board. In using Dreamweaver 8 in OSX 10.4.8, the program has suddenly

  • Multiple line item display for PAYMENT ADVISE form(script) using F110 tcode

    Dear All, I am currently working on PAYMENT ADVISE script ( form ) - for which i have copied the form F110_IN_AVIS to zform. I am executing the form for output through executing Tcode - F110. The output works for single line item entry of vendor line

  • Forms/Reports Chinese character support

    We have an existing db (10.2.0.4.0) and forms (11.1.2.1.0) application, that we're trying to extend to support Chinese characters. We're looking to add some unicode (nvarchar2) columns to existing tables, rather than converting the whole db charset.

  • CTS+ for Xi 3.0 Netweaver 2004(640)  with Netweaver 2004s(700) TMS domain

    Has anyone had success implementing CTS Plus for Xi 3.0?  The documentation says the loose coupling is possible as long as the TMS doman is on a NW 700 system. When I was configuring "Activate Deployment Service" (page 35 of How to Guide) I get the m