Jpanel not displaying

i have 2 Jpanels and at the click of a button, "a" should show up and "B" should be removed and call the validate method .now if i click another button the reverse should happen .but the panel does not show until i move my mouse on it .
please what can i do?

I think CardLayout is the better choice.
Add both panels to a component which uses the CardLayout manager, which you initialized as private member like
this.localCardLayout = new CardLayout();
this.setLayout(localCardLayout);
this.add(identifierPanelA, panelA);
this.add(identifierPanelB, panelB);where panelA and panelB are your panels and identifierPanelA and identifierPanelB are two different strings.
Initially this will show panelA, you can easily switch to panelB by calling the following method:
this.localCardLayout.show(this,identifierPanelB);

Similar Messages

  • JPanel not displaying in Windows

    I have a window displaying a panel and some buttons. I installed the application on Solaris and Windows. On Solaris, it displays fine every time. On Widows, it displays the first time I bring up the application but the panel does not display when I close it and bring it back up. Has anyone seen this before. I've put some debugging statements in, but I have no idea where to start looking.
    Thanks,
    Josh

    Here is the code that sets up the panel:
    // Initialize and GUI implementation
    private void jbInit() throws Exception {
    try{
    logger.fine("AudioEditPanel jbInit");
    this.setLayout(new BorderLayout());
    m_audioIcon = new ImageIcon(dataDir + File.separator + m_sAlertIcon);
    TitledBorder curSettingBorder = new TitledBorder(m_sCurSetting);
    TitledBorder soundBorder = new TitledBorder(m_sSound);
    m_editPanel.setLayout(new BorderLayout());
    // Create "Restore Default" button
    m_defaultButton.setText("Restore Default");
    m_defaultButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         defaultButton_actionPerformed(e);
    m_currentPanel.setLayout(new BorderLayout());
    m_currentPanel.setBorder(curSettingBorder);
    m_currentPanel.setPreferredSize(new Dimension(155, 165));
    // Create customized tabel model
    AudioTableModel tableModel = new AudioTableModel();
    curTable = new JTable(tableModel);
    //Set up column sizes.
    initColumnSizes(curTable, tableModel);
    // Only allows single selection
    curTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    curTable.setBorder(BorderFactory.createLoweredBevelBorder());
    curTable.setColumnSelectionAllowed(false);
    curTable.getTableHeader().setReorderingAllowed(false);
    setUpWavEditor(curTable);
    //Fiddle with the Preview column's cell editors/renderers.
    setUpPreviewColumn(curTable.getColumnModel().getColumn(preview_column));
    // Add filter for the File Choose, so only Sound (*.wav) file
    // can be used.
    fc.addChoosableFileFilter(new WavFilter());
    fc.setAcceptAllFileFilterUsed(false);
    fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    if (m_sDesDir != "") {
    File wav_dir = new File(m_sDesDir);
    fc.setCurrentDirectory(wav_dir);
    fc.setDialogTitle("List of audio files");
    m_assignPanel.setLayout(gridBagLayout1);
    m_assignPanel.setBorder(soundBorder);
    // "Selected Sound" label
    SelectSoundLabel.setFont(new java.awt.Font("Dialog", 0, 10));
    SelectSoundLabel.setForeground(Color.black);
    SelectSoundLabel.setText("Selected Sound:");
    //Click Browse button will pop up file chooser
    browseButton.setActionCommand("Browse");
    browseButton.setText("Browse");
    browseButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         browseButton_actionPerformed(e);
    //Click preview button will play the sound defined in the sound text area
    previewButton.setIcon(m_audioIcon);
    previewButton.setMargin(new Insets(0, 0, 0, 0));
    previewButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         previewButton_actionPerformed(e);
    // selected sound text field.
    sSoundText.setBorder(BorderFactory.createLoweredBevelBorder());
    sSoundText.addActionListener(new ActionListener() {
    public void actionPerformed (ActionEvent e) {
    sSoundText_actionPerformed(e);
    // "Preview" label
    previewTextArea.setFont(new java.awt.Font("Dialog", 0, 10));
    previewTextArea.setText("Preview");
    previewTextArea.setForeground(Color.black);
    // Use GridBag layout to put the components in the proper position
    m_defaultPanel.add(m_defaultButton, BorderLayout.CENTER);
    m_editPanel.add(m_assignPanel, BorderLayout.SOUTH);
    m_assignPanel.add(browseButton, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,GridBagConstraints.SOUTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 2, 0));
    m_assignPanel.add(previewButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 2));
    m_assignPanel.add(previewTextArea, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    m_assignPanel.add(sSoundText, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 3), 257, 2));
    m_assignPanel.add(SelectSoundLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(3, 0, 6, 0), 6, 0));
    m_curScrollPanel.getViewport().add(curTable, BorderLayout.CENTER);
    m_currentPanel.add(m_curScrollPanel, BorderLayout.CENTER);
    m_currentPanel.add(m_defaultPanel, BorderLayout.SOUTH);
    m_editPanel.add(m_currentPanel, BorderLayout.NORTH);
    m_tabbedPane.addTab(m_sAudioSetting, m_editPanel);
    this.add(m_tabbedPane, BorderLayout.CENTER);
    checkAudioPrefs();
    }catch(Exception e){
    e.printStackTrace();
    System.out.println(e.getMessage());
    }

  • JPanel not displaying components

    i am working on a simple html renderer- at the moment all i am trying to do is to add JTextPane components to two different JPanels (search and content). I can add the text panes to the search bar, however none of the components are displayed in the content panel. I get no compile time errors, im really at a loss as to what the problem could be.
    this is the code im using-
    public class Demo extends JFrame
        private JPanel search, content;
        private JSplitPane splitPane;
        //private ArrayList<JTextPane> textCollection;
        //private ArrayList<JTextPane> preCollection;
        //specifies the universal font size the content JPanel
        private final int fontSize = 18;
        //specifies the universal font size for the search JPanel
        private final int searchFontSize = 9;
        /** Creates a new instance of Main */
        public Demo()
          this.setTitle("DEMO!");
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          //sets default size
          this.setSize(500, 500);
          //init panel controls- these will hold all rendered controls
          search = new JPanel();
          //use BoxLayout to ensure controls are positioned correctly
          search.setLayout(new BoxLayout(search, BoxLayout.Y_AXIS));
          search.setBackground(Color.white);
          content = new JPanel();
          content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
          content.setBackground(Color.white);
          //init JScrollPanes for both containers- allows for scrolling content of unlimited width/length
          JScrollPane contentScroller = new JScrollPane(content);
          JScrollPane searchScroller = new JScrollPane(search);
          //create a split pane container to contain both scroll panes
          splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, searchScroller, contentScroller);
          //search bar recieves 25% of screen size
          splitPane.setDividerLocation(this.getWidth() / 4);
          this.getContentPane().add(splitPane);
          //show controls
          this.setVisible(true);
        * Creates a new text component- text contained will be line wrapped as the user resizes the JFrame
        public void newText(String text)
          //init properites of new JTextPane
          JTextPane tp = newTextPane(text);
          tp.setBackground(Color.blue);
          //line wrap add to content panel
          tp.setFont(new Font("Times New Roman", Font.PLAIN, fontSize));
          tp = getLines(tp, this.getWidth() - splitPane.getDividerLocation());
          content.add(tp);
          //resize text for search panel, line wrap and add to search panel
          tp.setFont(new Font("Times New Roman", Font.PLAIN, searchFontSize));
          tp = getLines(tp, splitPane.getDividerLocation());
          search.add(tp);
        * Creates a new preformated text component- this will not be line wrapped
        public void newPre(String preformattedContent)
            JTextPane tp = newTextPane(preformattedContent);
            tp.setBackground(Color.red);
            //add to content panel
            tp.setFont(new Font("Courier New", Font.PLAIN, fontSize));
            content.add(tp);
            //resize text for search panel and add to search panel
            tp.setFont(new Font("Courier New", Font.PLAIN, searchFontSize));
            search.add(tp);
        * Small method that init's a JTextPane component with common properites used by the newText/Pre methods
        private JTextPane newTextPane(String s)
          JTextPane tp = new JTextPane();
          //set text
          tp.setText(s);
          //may not be editied
          tp.setEditable(false);
          //align correctly
          tp.setAlignmentY(Component.TOP_ALIGNMENT);
          tp.setAlignmentX(Component.LEFT_ALIGNMENT);
          //set maximum size to preferred size, this makes sure the JTextComponent will not "stretch" when the JFrame is resized drastically
          tp.setMaximumSize(tp.getPreferredSize());
          return tp;
        * Sets the appropriate preferred height & width of a given JTextPanel, essentially word wrapping any text contained within
        private JTextPane getLines(JTextPane tp, int paneSize)
          //get preferred size of the text panel - this is the smallest size the text panel may be and still visibly display its text content
          Dimension d = tp.getPreferredSize();
          double prefWidth = d.getWidth();
          double prefHeight = d.getHeight();
          //factor will determine if line wrapping is required
          double factor = prefWidth / (double) paneSize;
          //if factor is greater than 1, the preferred width is greater than the size available in the pane
          if (factor >= 1){
            //set width so that it matches the size available on the screen
            d.setSize((double) this.getWidth() - paneSize, factor * prefHeight);
            tp.setMaximumSize(d);
            tp.setPreferredSize(d);
          //else- do nothing! resizing is not required
          return tp;
         * @param args the command line arguments
        public static void main(String[] args)
          Demo d = new Demo();
          d.newText("this is some content ooh look content i hope this is long enough to test the wrapp esfsdfsdf sdf sdfsdfsd fsdf sdfsdfsdfd sfsdf sdfsdxf sdf sdf sdfsd fsd fsdf ing");
          d.newPre("a     pre          formatted           lump of    =  text! !  !");
        public void paint(Graphics g)
            super.paint(g);
            System.out.println("update called");
            //preferred.setSize(this.getWidth() - (this.getWidth() / 4), this.getHeight());
            //max.setSize(this.getWidth(), this.getHeight());
    }

    Do you need to keep adding JTextPane's to the content and search panes or do you just need to append text to the existing panes?
    If the later, you may want to create the JTextPanes in the constructor and use a set method to append/edit/remove text. As follows:
    import javax.swing.*;
    import java.awt.*;
    public class Demo extends JFrame
        private JPanel search, content;
        private JSplitPane splitPane;
        private JTextPane contentTextPane;
        private  JTextPane searchTextPane;
        //private ArrayList<JTextPane> textCollection;
        //private ArrayList<JTextPane> preCollection;
        //specifies the universal font size the content JPanel
        private final int fontSize = 18;
        //specifies the universal font size for the search JPanel
        private final int searchFontSize = 9;
        /** Creates a new instance of Main */
        public Demo()
          this.setTitle("DEMO!");
          this.setDefaultCloseOperation(EXIT_ON_CLOSE);
          //sets default size
          this.setSize(500, 500);
          //init panel controls- these will hold all rendered controls
          search = new JPanel();
          //use BoxLayout to ensure controls are positioned correctly
          search.setLayout(new BoxLayout(search, BoxLayout.Y_AXIS));
          search.setBackground(Color.white);
          content = new JPanel();
          content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
          content.setBackground(Color.white);
          //init JScrollPanes for both containers- allows for scrolling content of unlimited width/length
          JScrollPane contentScroller = new JScrollPane(content);
          JScrollPane searchScroller = new JScrollPane(search);
          //create a split pane container to contain both scroll panes
          splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, searchScroller, contentScroller);
          //search bar recieves 25% of screen size
          splitPane.setDividerLocation(this.getWidth() / 4);
          /*add the textpanes to the JPanels*/
          contentTextPane = new JTextPane();
          content.add(contentTextPane);
          searchTextPane = new JTextPane();
          search.add(searchTextPane);
          this.getContentPane().add(splitPane);
          //show controls
          this.setVisible(true);
        * Creates a new text component- text contained will be line wrapped as the user resizes the JFrame
        public void newText(String text)
          //init properites of new JTextPane
          JTextPane tp = newTextPane(text);
          tp.setBackground(Color.blue);
          //line wrap add to content panel
          tp.setFont(new Font("Times New Roman", Font.PLAIN, fontSize));
          tp = getLines(tp, this.getWidth() - splitPane.getDividerLocation());
          content.add(tp);
          //resize text for search panel, line wrap and add to search panel
          tp.setFont(new Font("Times New Roman", Font.PLAIN, searchFontSize));
          tp = getLines(tp, splitPane.getDividerLocation());
          search.add(tp);
        public void addToContent(String text){
             contentTextPane.setText(text);
        * Creates a new preformated text component- this will not be line wrapped
        public void newPre(String preformattedContent)
            JTextPane tp = newTextPane(preformattedContent);
            tp.setBackground(Color.red);
            //add to content panel
            tp.setFont(new Font("Courier New", Font.PLAIN, fontSize));
            content.add(tp);
            //resize text for search panel and add to search panel
            tp.setFont(new Font("Courier New", Font.PLAIN, searchFontSize));
            search.add(tp);
        * Small method that init's a JTextPane component with common properites used by the newText/Pre methods
        private JTextPane newTextPane(String s)
          JTextPane tp = new JTextPane();
          //set text
          tp.setText(s);
          //may not be editied
          tp.setEditable(false);
          //align correctly
          tp.setAlignmentY(Component.TOP_ALIGNMENT);
          tp.setAlignmentX(Component.LEFT_ALIGNMENT);
          //set maximum size to preferred size, this makes sure the JTextComponent will not "stretch" when the JFrame is resized drastically
          tp.setMaximumSize(tp.getPreferredSize());
          return tp;
        * Sets the appropriate preferred height & width of a given JTextPanel, essentially word wrapping any text contained within
        private JTextPane getLines(JTextPane tp, int paneSize)
          //get preferred size of the text panel - this is the smallest size the text panel may be and still visibly display its text content
          Dimension d = tp.getPreferredSize();
          double prefWidth = d.getWidth();
          double prefHeight = d.getHeight();
          //factor will determine if line wrapping is required
          double factor = prefWidth / (double) paneSize;
          //if factor is greater than 1, the preferred width is greater than the size available in the pane
          if (factor >= 1){
            //set width so that it matches the size available on the screen
            d.setSize((double) this.getWidth() - paneSize, factor * prefHeight);
            tp.setMaximumSize(d);
            tp.setPreferredSize(d);
          //else- do nothing! resizing is not required
          return tp;
         * @param args the command line arguments
        public static void main(String[] args)
          Demo d = new Demo();
          d.newText("this is some content ooh look content i hope this is long enough to test the wrapp esfsdfsdf sdf sdfsdfsd fsdf sdfsdfsdfd sfsdf sdfsdxf sdf sdf sdfsd fsd fsdf ing");
          d.newPre("a     pre          formatted           lump of    =  text! !  !");
          d.addToContent("testing the content panel");
        public void paint(Graphics g)
            super.paint(g);
            System.out.println("update called");
            //preferred.setSize(this.getWidth() - (this.getWidth() / 4), this.getHeight());
            //max.setSize(this.getWidth(), this.getHeight());
    }If this is not the case let me know and Ill take another look. ;-)

  • Adding and displaying a new JPanel -- not working as expected

    I'm starting my own new thread that is based on a problem discussed in another person's thread that can be found here in the New to Java forum titled "ActionListener:
    http://forum.java.sun.com/thread.jspa?threadID=5207301
    What I want to do: press a button which adds a new panel into another panel (the parentPane), and display the changes. The Actionlistener-derived class (AddPaneAction) for the button is in it's own file (it's not an internal class), and I pass a reference to the parentPane in the AddPaneAction's constructor as a parameter argument.
    What works: After the button is clicked the AddPaneAction's actionPerformed method is called without problem.
    What doesn't work: The new JPanel (called bluePanel) is not displayed as I thought it would be after I call
            parentPane.revalidate();  // this doesn't work
            parentPane.repaint(); 
    What also doesn't work: So I obtained a reference to the main app's JFrame (I called it myFrame) by recursively calling component.getParent( ), no problem there, and then tried (and failed to show the bluePanel with) this:
            myFrame.invalidate();  // I tried this with and without calling this method here
            myFrame.validate();  // I tried this with and without calling this method here
            myFrame.repaint();
    What finally works but confuses me: I got it to work but only after calling this:
            myFrame.pack(); 
            myFrame.repaint();But I didn't think that I needed to call pack to display the panel. So, what am I doing wrong? Why are my expectations not correct? Here's my complete code/SSCCE below. Many thanks in advance.
    Pete
    The ParentPane class:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import javax.swing.BorderFactory;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class ParentPane extends JPanel
        private JButton addPaneBtn = new JButton("Add new Pane");
        public ParentPane()
            super();
            setLayout(new BorderLayout());
            setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
            setBackground(Color.yellow);
            JPanel northPane = new JPanel();
            northPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
            northPane.setBackground(Color.yellow);
            northPane.add(addPaneBtn);
            add(northPane, BorderLayout.NORTH);
            // add our actionlistener object and pass it a reference
            // to the main class which happens to be a JPanel (this)
            addPaneBtn.addActionListener(new AddPaneAction(this));
        public static void main(String[] args)
            javax.swing.SwingUtilities.invokeLater(new Runnable()
                public void run()
                    createAndShowGUI();
        private static void createAndShowGUI()
            JFrame frame = new JFrame("test add panel");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.getContentPane().add(new ParentPane());
            frame.pack();
            frame.setVisible(true);
    } the AddPaneAction class:
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.SwingConstants;
    public class AddPaneAction implements ActionListener
        private JPanel parentPane;
        private JFrame myFrame;
        public AddPaneAction(JPanel parentPane)
            this.parentPane = parentPane;
         * recursively get the JFrame that holds the parentPane panel.
        private JFrame getJFrame(Component comp)
            Component parentComponent = comp.getParent();
            if (parentComponent instanceof JFrame)
                return (JFrame)parentComponent;
            else
                return getJFrame(parentComponent);
        public void actionPerformed(ActionEvent arg0)
            JPanel bluePanel = new JPanel(new BorderLayout());
            bluePanel.setBackground(Color.blue);
            bluePanel.setPreferredSize(new Dimension(400, 300));
            JLabel myLabel = new JLabel("blue panel label");
            myLabel.setForeground(Color.LIGHT_GRAY);
            myLabel.setVerticalAlignment(SwingConstants.CENTER);
            myLabel.setHorizontalAlignment(SwingConstants.CENTER);
            bluePanel.add(myLabel, BorderLayout.CENTER);
            parentPane.add(bluePanel);
            myFrame = getJFrame(parentPane);
            //parentPane.revalidate();  // this doesn't work
            //parentPane.repaint(); 
            //myFrame.invalidate(); // and also this doesn't work
            //myFrame.validate();
            //myFrame.repaint();
            myFrame.pack();  // but this does!?
            myFrame.repaint();
    }

    For me (as it happens I'm using JDK 1.5.0_04) your code appears to work fine.
    It may be that we're seeing the same thing but interpreting it differently.
    1. When I run your application with your "working" code, and press the button then the JFrame resizes and the blue area appears.
    2. When I run your application with your "not working" code and press the button then the JFrame does not resize. If I manually resize it then the blue area is there.
    3. When I run your application with your "not working" code, resize it first and then press the button then the JFrame then the blue area is there.
    I interpret all of this as correct behaviour.
    Is this what you are seeing too?
    Are you expecting revalidate, repaint, invalidate or validate to resize your JFrame? I do not.
    As an aside, I do remember having problems with this kind of thing in earlier JVMs (e.g. various 1.2 and 1.3), but I haven't used it enough recently to know if your code would manifest one of the previous problems or not. Also I don't know if they've fixed any stuff in this area.

  • JDialog not displaying correctly

    Hi all,
    Im having this problem with displaying a JDialog. I have a lengthy delay in my app and want to display an animated GIF while the user is waiting. The below code is what im trying to run. The JDialog wil display, but the title text, message text and the ImageIcon are not displayed on the JDialog. Anyone know what is wrong? Do i have to wait on the Image to load before i .show the dialog? But that wouldn't explain why the text doesn't show. Any help appreciated
    Code im trying to run, RemoteAdminMain.java
        WaitingDialog dialog = new WaitingDialog(this, "Connection...", false, "Creating Connection");
        try {
          //Create the connection...
          dialog.show();
          RemoteAdminMain.nc = NetConnection.createNetConnection(nodeAddress, Global.sessionUsername, Global.sessionPassword);
          dialog.dispose();
        } catch (Exception e) {
          dialog.dispose();
          JOptionPane.showMessageDialog(null, "Error", "Error", JOptionPane.ERROR_MESSAGE);
          e.printStackTrace();
          return;
    The Dialog code: WaitingDialog.java
    public class WaitingDialog extends JDialog {
      private JPanel panel1 = new JPanel();
      private BorderLayout borderLayout1 = new BorderLayout();
      private JLabel jLabel1 = new JLabel();
      private JLabel jLabel2 = new JLabel();
      public WaitingDialog(Frame frame, String title, boolean modal, String message) {
        super(frame, title, modal);
        try {
          jLabel2.setText(message);
          jbInit();
          pack();
        catch(Exception ex) {
          ex.printStackTrace();
        //Center the window
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension dialogSize = getSize();
        if (dialogSize.height > screenSize.height) {
          dialogSize.height = screenSize.height;
        if (dialogSize.width > screenSize.width) {
          dialogSize.width = screenSize.width;
        setLocation((screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2);
      public WaitingDialog() {
        this(null, "", false, "");
      void jbInit() throws Exception {
        panel1.setLayout(borderLayout1);
        jLabel2.setToolTipText("");
        jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel2.setHorizontalTextPosition(SwingConstants.CENTER);
        jLabel2.setText("message");
        jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
        jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
        ImageIcon icon = new ImageIcon(com.tempo.netservice.RemoteAdminMain.class.getResource("swing.gif"));
        icon.setImageObserver(jLabel1);
        jLabel1.setIcon(icon);
        this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
        this.setResizable(false);
        this.setTitle("");
        getContentPane().add(panel1);
        panel1.add(jLabel1, BorderLayout.CENTER);
        panel1.add(jLabel2,  BorderLayout.SOUTH);
    }

    I fear the problem isn't with the JDialog itself, everything is from from that point of view. I forgot to mention that if you set it as Modal, it will display fine (however, the modal method is blocking, meaning the createNetConnection method will not be executed until the dialog is closed, entirly defeating the purpose.
    I believe the problem is that the createNetConnection function stops the rest of the JDialog from loading. So i guess my question to begin with is, is there anyway to completly display and paint the JDialog before allowing it to continue onto the next function?

  • Button not Displaying in JRE 1.4.2

    We have one Applet with Image button and it used to work fine with JRE 1.4.1. If I install JRE 1.4.2 in my Machine Image Buttons are not displaying.
    We coded as follows
    public class ImageButton extends JButton {
    private Image image = null ;
    private ActionListener listener = null ;
    public ImageButton( Image image ) {
    super(new ImageIcon ( image ));
    this.image = image ;
    setCursor(new Cursor ( Cursor.HAND_CURSOR ) ) ;
    setBorderPainted ( false ) ;
    setOpaque(false) ;
    setBorder(null);
    setMargin(new Insets ( 0, 0, 0, 0 ) ) ;
    public class StartPanel extends OutputPanel implements ActionListener {
    private ImageButton pb_START = new ImageButton ( AppletUtil.loadImage ( "start.gif" ) ) ;
    private RadarApplet applet = null ;
    /** A panel to hold buttons */
    private JPanel pnl_BUTTONS = new JPanel () ;
    * Constructor for StartPanel.
    public StartPanel( RadarApplet applet ) {
    super();
    this.applet = applet ;
    setBackground ( Color.white ) ;
    pnl_BUTTONS.setLayout ( new FlowLayout( FlowLayout.CENTER, 3, 0 ) ) ;
    pnl_BUTTONS.setBackground ( Color.white ) ;
    pnl_BUTTONS.add ( pb_START ) ;
    add ( pnl_BUTTONS ) ;
    pb_START.addActionListener ( this ) ;
    showProgress(false) ;
    setLowerComponent ( pnl_BUTTONS ) ;
    setText( RadarConfiguration.getString( "ready_to_download" ) ) ;
    setDescription( RadarConfiguration.getString( "ready_to_download_desc" ) ) ;
    * @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
    public void actionPerformed(ActionEvent e) {
    ( e.getSource() == pb_START )
    new Thread ( new Runnable () {
    public void run () {
    applet.startProcess() ;
    } ).start() ;
    }

    One thing to add for clarification, the problem I described is the application display problem and NOT the screen capture problem.
    Yu-Ten Lee

  • JFileChooser problem - it will not display

    I have read the tutorial on JFileChoosers and understand the basics, however, my application will simply not display a File Chooser. I select the menu option "open file" and the command prompt window just spews out dozens of garbage. The code is below if there are any FileChooser "Pros" out there. The FileChooser is selected for loading in the actioPerformed method. Thanks for any assistance.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.JFileChooser;
    import javax.swing.filechooser.*;
    public class DissertationInterface extends JFrame implements ActionListener
         private JPanel onePanel, twoPanel, bottomPanel;
           private JButton quit,search;
           private JMenuBar TheMenu;
           private JMenu menu1, submenu;
         private JMenuItem menuItem1;
         private JFileChooser fc;          //FILE CHOOSER
           private BorderLayout layout;
           //Canvas that images should be drew on
           //drawTheImages Dti;
           //Instances of other classes
         //DatabaseComms2 db2 = new DatabaseComms2();
         //Configuration cF = new Configuration();
           public DissertationInterface()
                setTitle("Find My Pics - University Application") ;
                layout = new BorderLayout();          
                Container container = getContentPane();
                container.setLayout(layout);
                //Dti = new drawTheImages();
              //container.add(Dti);
                quit = new JButton("Quit");
                search = new JButton("Search");
                TheMenu = new JMenuBar();
                setJMenuBar(TheMenu);
                //FILE CHOOSER
                JFileChooser fc = new JFileChooser();     
                fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                //First menu option = "File";
                menu1 = new JMenu("File");
              TheMenu.add(menu1);
                //Add an option to the Menu Item
                menuItem1 = new JMenuItem("OPEN FILE",KeyEvent.VK_T);
            menuItem1.setAccelerator(KeyStroke.getKeyStroke(
            KeyEvent.VK_1, ActionEvent.ALT_MASK));
              menu1.add(menuItem1);
              menuItem1.addActionListener(this);          //action listener for Open file option
                //CREATE 3 PANELS
                onePanel = new JPanel();
                onePanel.setBackground(Color.blue);
                onePanel.setLayout(new FlowLayout(FlowLayout.CENTER, 200, 400)) ;
                twoPanel = new JPanel();
                twoPanel.setBackground(Color.red);
                twoPanel.setLayout(new GridLayout(5,2,5,5));
                bottomPanel = new JPanel();
                bottomPanel.setBackground(Color.yellow);
                bottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10));
              //ADD COMPONENTS TO THE PANELS
                //Add the menu bar and it's items to twoPanel
              twoPanel.add(TheMenu, BorderLayout.NORTH);
              twoPanel.setAlignmentY(LEFT_ALIGNMENT);
                bottomPanel.add(quit);
                quit.addActionListener(this);          //action listener for button
                bottomPanel.add(search);
                search.addActionListener(this);          //action listener for button
                //ADD PANELS TO THE WINDOWS
                container.add(onePanel, BorderLayout.CENTER);
                container.add(twoPanel,BorderLayout.NORTH);            
                container.add(bottomPanel, BorderLayout.SOUTH);
                //setSize(350,350);
                setVisible(true);
              }//END OF CONSTRUCTOR
            public void leaveWindow()
                 this.dispose() ;
            public static void main(String args[])
            DissertationInterface DI = new DissertationInterface();
            DI.setVisible(true);
            //Display the window.
            DI.setSize(450, 260);
            DI.setVisible(true);
            DI.pack();
         }//End of main method
         protected void processWindowEvent(WindowEvent e)
                super.processWindowEvent(e);
                if(e.getID()== WindowEvent.WINDOW_CLOSING)
                      System.exit(0);
              }//End of processWindowEvent
    //method to resolve button clicks etc
    public void actionPerformed(ActionEvent e)
              //PROBLEM IS HERE !!!!!!! - why won't the file dialogue box open
              if(e.getActionCommand().equals("OPEN"))
                   int returnVal = fc.showOpenDialog(DissertationInterface.this);
                 else if(e.getActionCommand().equals("Quit"))
                      //closeDialog();
                      System.out.println("User interface exited");
                      System.exit(1);
                      leaveWindow();
              else if(e.getActionCommand().equals("Search"))
                      //pass params to database                                 
                 }//end of else if
    } //end of method ActionPerformed
    }//End of class DissertationInterface

    I have done as stated, code compiles/executes but when I select the open file option on my GUI, the command prompt window freezes and no dialogue box is displayed!!!!

  • Images not displayed properly.Any advice on that?

    Hi,
    I found the following code inside the forum and i'm trying to understand it.
    It appears to be a problem though. In particular the images(chess-pieces) are not displayed properly. The background of the gif images should be transparent but is not. Any advice?
    Thanks
    Here is the code:
    import java.awt.*;
    import javax.swing.*;
    public class ChessBoard10 {
    static final int PAWN = 0;
    JFrame frame;
    JComponent[][] checker;
    public ChessBoard10() {
    frame = new JFrame("CHESS GAME");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container con = frame.getContentPane();
    con.setLayout(new GridLayout(8, 8));
    checker = new JComponent[8][8];
    for (int row = 0; row < 8; ++row) {
    for (int col = 0; col < 8; ++col) {
    JComponent p = new JPanel();
    p.setBackground(setColor(row, col));
    checker[row][col] = p;
    con.add(p);
    frame.setSize(500, 550);
    frame.setVisible(true);
    Color setColor(int y, int x) {
    Color c;
    if (y % 2 == 1) {
    if (x % 2 == 1) {
    c = Color.white;
    } else {
    c = Color.black;
    } else {
    if (x % 2 == 1) {
    c = Color.black;
    } else {
    c = Color.white;
    return c;
    public void setPiece(Piece pc, int row, int col) {
    JComponent p = checker[row - 1][col - 1];
    //one base -> zero base conversion
    if (p.getComponentCount() > 0) {
    p.remove(0);
    p.add(pc);
    p.revalidate();
    /*test*/
    public static void main(String[] args) {
    int Bpawn = 0,
    Bbishop = 1,
    Bking = 2,
    Bknight = 3,
    Bqueen = 4,
    Brock = 5,
    Wpawn = 6,
    Wbishop = 7,
    Wking = 8,
    Wknight = 9,
    Wqueen = 10,
    Wrock = 11;
    ChessBoard10 cb = new ChessBoard10();
    for (int i = 1; i < 9; i++) {
    cb.setPiece(new Piece(Bpawn), 2, i);
    cb.setPiece(new Piece(Wpawn), 7, i);
    cb.setPiece(new Piece(Bking), 1, 4);
    cb.setPiece(new Piece(Bqueen), 1, 5);
    cb.setPiece(new Piece(Bbishop), 1, 3);
    cb.setPiece(new Piece(Bbishop), 1, 6);
    cb.setPiece(new Piece(Bknight), 1, 2);
    cb.setPiece(new Piece(Bknight), 1, 7);
    cb.setPiece(new Piece(Brock), 1, 1);
    cb.setPiece(new Piece(Brock), 1, 8);
    cb.setPiece(new Piece(Wking), 8, 4);
    cb.setPiece(new Piece(Wqueen), 8, 5);
    cb.setPiece(new Piece(Wbishop), 8, 3);
    cb.setPiece(new Piece(Wbishop), 8, 6);
    cb.setPiece(new Piece(Wknight), 8, 2);
    cb.setPiece(new Piece(Wknight), 8, 7);
    cb.setPiece(new Piece(Wrock), 8, 1);
    cb.setPiece(new Piece(Wrock), 8, 8);
    class Piece extends JPanel {
    String[] imgfile =
    "Bpawn.gif",
    "Bbishop.gif",
    "Bking.gif",
    "Bknight.gif",
    "Bqueen.gif",
    "Brock.gif",
    "Wpawn.gif",
    "Wbishop.gif",
    "Wking.gif",
    "Wknight.gif",
    "Wqueen.gif",
    "Wrock.gif" };
    public Piece(int type) {
    add(new JLabel(new ImageIcon(imgfile[type])));
    }

    Well, without actually testing the code which I most unfortunately can't do since my real computer is chrashed at the moment, try checking the
    boolean Component.isOpaque();otherwise try using .png's instead altough it shouldn't matter.
    This is just some general advices =(

  • Buttons are not displayed for the first time when drawImage method is used

    Hi
    In my swing window 2 buttons are there and when clicking these buttons, it should display an image . The two buttons are displayed at the first time and I can click on it . While clicking a button , the corresponding image is also got displayed. [ I am using drawImage() function for it] But what the problem is, then the two buttons are not displayed and it will be displayed again when the mouse moves along the position of these two buttons. And this problem occurs only at the first time..When they are on the window on a second time, they won't vanish when the image is displayed when clicking it. Is this the problem with paint() method?. I am using start() method also.
    Please help me!
    Thank You

    Hi
    This is not my exact program, that has a large no: of code. So I am putting here a sample one. One thing I would like to point out is that , I can see the buttons at the time of loading the applet and suddenly it vanishes and the image is drawn. Then if I move the mouse along the position of these buttons , they got displayed.
    import java.awt.*;
    import javax.swing.*;
    /*<applet code = MyClass width = 500 height = 500>
    </applet>
    public class MyClass extends JApplet
    Image img;
    JButton b1,b2;
    Container cp;
    Canvas1 cv;
    class Canvas1 extends JPanel
    public void paint(Graphics g)
    super.paint(g);
    g.setColor(Color.black);
    g.fillRect(0,0,500,500);
    img = getImage(getCodeBase(),"image1.jpeg");
    g.drawImage(img,20,20,this);
    public void start()
    cv = new Canvas1();
    cv.setBounds(0,0,500,500);
    cp.add(cv);
    public void init()
    setLayout(null);
    cp = getContentPane();
    b1 = new JButton("Button1");
    b1.setBounds(1,1,100,30);
    cp.add(b1);
    b2 = new JButton("Button2");
    b2.setBounds(200,1,100,30);
    cp.add(b2);
    It would be very helpful to me if you could fix the problem.
    Thank You.

  • JInternalFrame is not displayed properly in jDesktopPane

    I am developing a project in NetBeans 6.5. I've designed a JInternalFrame "newInvoiceIF" which contains JPanel. The JPanel has Free Design as a layout which is by default in NetBeans. The other components like textfields, labels, separator & buttons are placed on JPanel. My problem is that when JFrame is added to JDesktopPane at the runtime it doesn't display complete JPanel. The width of panel seems to be more than displayed internalframe. Right hand side components are not displayed partially I have set size of the internal frame to the size of desktoppane as shown in the code below.
    NewInvoiceIF newInvoiceIF = new NewInvoiceIF();
    newInvoiceIF.setSize(myDesktopPane.getSize());
    newInvoiceIF.show();
    myDesktopPane.add(newInvoiceIF);
    myDesktopManager.activateFrame(newInvoiceIF);
    I've also tried pack() method but it make internal frame larger than desktoppane & then i need to drag internal frame towards left to see right hand side components. Can anybody tell me solution that'll rearrange components within internalframe at runtime so that all components are displayed within desktoppane size limit.

    Agrees with Olek. It may be time to bite the bullet and learn how to use the many layout managers that are available in Swing. The Sun tutorial dose a decent job explaining these, but I think that it puts a little too much emphasis on the GridBagLayout, one of the more difficult layout managers.

  • JSplitPane not displaying on screen

    Someone please help me. Stuck on this problem for 3 days now but just cannot see the answer. JSplitPane just does not display on screen. When I call it from within the class xer it appears as a little rectangle of about 2mm by 4 mm insize. When I call it from within actionPerformed I just do not see anything at all. I need to call it from actionPerformed as a final solution. Please give the answer based on it being called from actionPerformed. Thanks.
    Peter Loo
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.tree.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.lang.*;
    public class xer extends JFrame
    JPanel erPanel;
    Container contentPane;
    public xer()
    contentPane = getContentPane();
    erPanel = new JPanel();
    contentPane.add(erPanel);
    // Menu
    ErMenu erMenu = new ErMenu(contentPane, erPanel);
    setJMenuBar (erMenu.getErMenuBar());
    // If I call Define Report here I have small JSplitPane about 2mm by 4 mm size
    new DefineReport(contentPane, erPanel);
    pack();
    setExtendedState(Frame.MAXIMIZED_BOTH);
    setDefaultCloseOperation (DISPOSE_ON_CLOSE);
    setVisible(true);
    public static void main (String args[])
    new xer();
    * Processing for menu
    class ErMenu implements ActionListener
    Container contentPane;
    JPanel erPanel;
    JMenuBar erMenuBar;
    JMenu fileMenu;
    JMenu reportMenu;
    JMenuItem defineMenuItem;
    JMenuItem runMenuItem;
    DefineReport defineReport;
    StringBuffer currentScreen;
    * Create menu & menubar
    public ErMenu (Container contentPane, JPanel erPanel)
    this.contentPane = contentPane;
    this.erPanel = erPanel;
    // Menu bar
    erMenuBar = new JMenuBar ();
    // Menu reports
    reportMenu = new JMenu (" Report ");
    defineMenuItem = new JMenuItem ("Define Report");
    defineMenuItem.setActionCommand ("MenuItemDefineReport");
    defineMenuItem.addActionListener (this);
    reportMenu.add(defineMenuItem);
    runMenuItem = new JMenuItem ("Run Report");
    runMenuItem.setActionCommand ("MenuItemRunReport");
    runMenuItem.addActionListener (this);
    reportMenu.add (runMenuItem);
    erMenuBar.add (reportMenu);
    public JMenuBar getErMenuBar()
    return erMenuBar;
    public void actionPerformed (ActionEvent e)
    String menuaction = e.getActionCommand();
    if (menuaction.compareTo ("MenuItemDefineReport") == 0)
    // If I call Define Report here I do not get the JSplitPane
    defineReport = new DefineReport(this.contentPane, this.erPanel);
    * Main processing for Defining a report
    class DefineReport
    JPanel erPanel;
    Container contentPane;
    JSplitPane erJSplitPane;
    public DefineReport (Container contentPane, JPanel erPanel)
    this.erPanel = erPanel;
    this.contentPane = contentPane;
    // this.contentPane.invalidate();
    // this.contentPane.removeAll();
    // this.erPanel.invalidate();
    // this.erPanel.removeAll();
    erJSplitPane = setupErJSplitPane ();
    erPanel.add (erJSplitPane);
    // contentPane.add(erPanel);
    contentPane.setVisible(true);
    } // End of constructor DefineReport
    public JSplitPane setupErJSplitPane()
    JScrollPane listScrollPane;
    JScrollPane treeScrollPane;
    listScrollPane = new JScrollPane ();
    treeScrollPane = new JScrollPane ();
    erJSplitPane = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT,
    listScrollPane, treeScrollPane);
    erJSplitPane.setOneTouchExpandable (true);
    erJSplitPane.setDividerLocation (50);
    Dimension minSize = new Dimension (50,50);
    listScrollPane.setMinimumSize (minSize);
    treeScrollPane.setMinimumSize (minSize);
    listScrollPane.setBackground(Color.red);
    listScrollPane.setForeground(Color.red);
    treeScrollPane.setBackground(Color.blue);
    treeScrollPane.setForeground(Color.blue);
    return erJSplitPane;
    } // End of class DefineReport

    I have read all the tutorials that I can find and it
    seems (at least to me) that I have done everything
    necessary. I am really quite new to Java.
    Peter LooIts called a learning curve dear, we've all been there

  • A Components not displayed in JDialog opened from Applet.

    Hi. I have an Applet from which I am opening a JDialog, that contains a JPanel with some JTextFields. Sometimes half of textfields are not displayed. Does anybody know something about such problem?

    When you say sometimes do you mean sometimes or do
    you mean all the time?sometimes.
    In general when you have a condition that only
    sometimes occurs this is the result of a race
    condition. Assuming that this is something you see
    only sometimes, my guess is that you are displaying
    the dialog (calling setVisible(true)) before you have
    finished adding all the componentsYep. you are 100% right. found it. it was not synchronized lazy initialization called from some callbacks in different threads. ;)

  • I'm having trouble getting a custom JPanel to display correctly...

    HI, I'm having trouble getting a custom JPanel to display correctly. I'm using the JPanel inside a JFrame to display some really custom graphs. The graphing side of this whole thing works flawlessly. The problem I'm having is that when I close the JFrame by using setVisible(false); and then openning it again using setVisible(true); all the information on it is garbage. There are buttons from the JFrame which orgininally opened it and it has trouble openning a second graph if I choose too. I also have the same problem if i move the frame off the screen and move it back. I'd really appreciate any help.
    Thanks!

    With option #1 -- I modified and rebuilt the 3rd-party JARs and referenced them in NetBeans. When I choose clean and build, the Ant processes results in an error: "jarsigner returns 1". So it doesn't seem to run at all.As long as you rebuilt the jars correctly without the original signature, I think it should work.
    An example of unsigning a jar using ant is here:
    http://frank.zinepal.com/unsign-a-jar-with-ant
    Do you think the multiple-JNLP idea would work if NetBeans didn't apply "my" signature to the 3rd-party JARs? Aside from manually copying the original JARs into the \dist directory, is there a better way to tell NetBeans to leave the 3rd-party JAR alone (ie, don't sign it again)?I think it's supposed to work (it's the mixed code signing situation I referred to in my prior post).
    For example, from your description it sounds like the default NetBeans build doesn't really support this style of deployment, so you would have to create a custom build which does what you need and is not triggered by NetBeans - which is doable, but annoying - it's sounds like you tried this, but were unable to get it to work as expected. For NetBeans specific help, you are better posting to a NetBeans forum (though you might be just the second person who has tried to do this with a JavaFX app).
    Also need to check the end user experience is acceptable too, because I think the dialog and warning handling for the mixed code situation is different.
    Look at the deployment guide section "Using <fx:resources> for Extension Descriptors" - I think it documents how to do what you want if you use a custom build file rather than letting NetBeans do the work:
    http://docs.oracle.com/javafx/2/deployment/javafx_ant_task_reference002.htm#CIABGCEE
    Hmm, a lot of running around to deploy an app which can open a file . . .

  • The circle is not display

    Dear all
    Why the circle not display on the panel?
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class CustomPanel1 extends JFrame { 
    private final String list[] = { "Circle"};
    private FlowLayout layout1, layout3;
    private DrawShape drawPanel;
    private JComboBox shapeList;
    private JTextField textField1, textField2;
    public static int size;
    public CustomPanel1() {   
    // create custom drawing area
    drawPanel = new DrawShape();
    shapeList = new JComboBox(list);
    shapeList.setMaximumRowCount(3);
    //add ItemListener
    shapeList.addItemListener(
    new ItemListener(){
    // handle item state change event
    public void itemStateChanged (ItemEvent event) {                  
    if(event.getStateChange() == ItemEvent.SELECTED){
    // draw circle
    if( shapeList.getSelectedIndex() == 0){           
    DrawShape.shape = 0;
    drawPanel.draw( DrawShape.Circle);
    } // end if
    JPanel parameterPanel = new JPanel();
    layout1 = new FlowLayout();
    parameterPanel.setLayout(layout1);
    parameterPanel.setBackground( Color.PINK );
    layout1.setAlignment( FlowLayout.CENTER);
    parameterPanel.add( new JScrollPane(shapeList));
    JPanel textPanel = new JPanel();
    layout3 = new FlowLayout();
    parameterPanel.setLayout(layout3);
    textPanel.setBackground( Color.PINK );
    layout3.setAlignment( FlowLayout.CENTER);
    textField1 = new JTextField( "Size");
    textField1.setFont(new Font("Serif",Font.BOLD,14));
    textField1.setEditable (false);
    textField2 = new JTextField( "",6);
    textField2.setFont(new Font("Serif",Font.BOLD,14));
    // add ActionListener
    textField2.addActionListener(
    new ActionListener(){
    // handle action perform event
    public void actionPerformed (ActionEvent event) {         
    JTextField field = (JTextField)event.getSource();
    String entry = field.getText();
    size = Integer.parseInt(entry);
    } // end handle
    } // end anonymous inner class
    ); // end call to addActionListener
    textPanel.add(textField1, BorderLayout.NORTH);
    textPanel.add(textField2, BorderLayout.SOUTH);
    // set up the combine panel of parameterPanel and textPanel
    GridLayout gridLayout = new GridLayout();
    gridLayout.setRows(2);
    gridLayout.setColumns(1);
    JPanel combinPanel = new JPanel();
    combinPanel.setBackground( Color.PINK );
    combinPanel.setLayout(gridLayout);
    combinPanel.add(parameterPanel, BorderLayout.NORTH);
    combinPanel.add(textPanel, BorderLayout.SOUTH);
    Container container = getContentPane();
    container.add( combinPanel, BorderLayout.NORTH);
    container.add( drawPanel, BorderLayout.CENTER );
    // container.add( dataPanel, BorderLayout.SOUTH );
    setSize( 500, 500 );
    setVisible( true );
    } // end constructor CustomPanelTest
    // main
    public static void main ( String args[] ) {   
    CustomPanel1 app = new CustomPanel1();
    app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } // end main
    } // end class CustomPanelTest
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawShape extends JPanel {
    public final static int Circle = 0, Square = 1, Triangle = 2;
    public static int shape;
    public static int xPos,yPos;
    CustomPanel1 client;
    boolean shapeWasCreated = false;
    public DrawShape(){
    public DrawShape(CustomPanel1 customer){     
    this.client = customer;
    addMouseListener(
    new MouseAdapter() {  // anonymous inner class
    // handle mouse press event
    public void mousePressed( MouseEvent event )
    xPos = event.getX();
    yPos = event.getY();
    shapeWasCreated = true;
    repaint();
    } // end handle
    } // end anonymous inner class
    ); // end call to addMouseListener
    } // end method
    public void draw( int shapeToDraw )
    shape = shapeToDraw;
    repaint();
    } //end method
    } // end class
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class DrawCircle extends DrawShape {
    CustomPanel1 client;
    public static double circleArea, circlePerimeter;
    public DrawCircle(CustomPanel1 circleCustomer){     
    super(circleCustomer);
    this.client = circleCustomer;
    } // end method
    public void paintComponent( Graphics g )
    super.paintComponent( g );
    initializeShapeVariables();
    if ( shape == Circle ) {        
    g.drawOval(xPos ,yPos , CustomPanel1.size, CustomPanel1.size );
    } //end if
    private void initializeShapeVariables(){
    area = 0;
    perimeter = 0;
    circleArea = 0;
    circlePerimeter = 0;
    } // end method
    // set shape value and repaint
    public void draw( int shapeToDraw ) {    
    shape = shapeToDraw;
    repaint();
    } //end method
    } // end class

    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore, go into Recovery Mode per the instructions here.  Since you have chosen not to maintain a backup, Recovery Mode will result in complete loss of data.  Anything obtained from the iTunes Store can be downloaded again but everything else will be gone forever.

  • JComboBox is not displaying the down arrow..

    jComboBox is not displaying the down arrow..
    I was first using the "choice" component but was having problems with the size only on Unix. So I changed it to a jComboBox and I'm having problems on both NT and UNIX. First the down arrow doesn't show up on NT....and the drop down doesn't even show up on UNIX.
    Any ideas?
    Thanks!
    pt

    could be coz you have not left enough room for it on the layout of your JPanel?

Maybe you are looking for

  • Previewing a pdf document created by Acrobat 5.0 in IE 7

    I have a document converted to pdf format by Adobe Acrobat 5.0 that needs to be accessible for viewing and download from a web page.  I got it uploaded to the website and there is a link to the file on the website's home page.  I have Adobe Reader 9.

  • Applications quitting unexpectedly and Force Quit doesn't work

    Hi there - Hoping someone can help me out because this is driving me crazy! For the last week or so, probably 75% of the time that I save my work on word, excel or numbers the application stops responding. Force Quit either doesn't work or takes an e

  • VIDEO "THE NEW STANDARD"

    *_VIDEO RECORDING CAPABILITIES_* Okay so why does Apple not come out with a Video Application for the iPhone? In a previous discussion it was mentioned that less expensive phones have video capabilities. Obsolete phones have video and iPhone does not

  • Can we change background of the table

    can any body knows how to change backgorung of the table component and also how to add buttons in a table header thanks in advance

  • How get OBJECT_ID for using ARCHIV_BARCODE_GLOBAL function?

    Hello experts: Do you know how can I get the object_id that I must fill for using ARCHIV_BARCODE_GLOBAL function? Please any help is very helpfull. Best regards and thanks in advance for your time. Miriam