Problem relating painting swing component

Hi All,
I am making a swing application in which there is one central Panel on which i am showing some dynamic contents from database
but the problem is that data is comming from database but it is not painted automatically on screen and when i move mouse to central panel the contents are printed.
plz help me
how i do this painting imidiately .
Thanx

Hi All,
i am using repaint() after each update but the panel is not painted automatically the panel appears when i thake mouse over that panel.
in my screen there is on treePanel which contains tree now
i want my centerpanel of screen to be dynamic that is of click on any
node of the tree it display its summry this summry is comming fron database.
for this on each mouse click of tree node i first clear the centralPanel
then add another panel in this centralPanel.
but the only problem is that it is not reflected imidiately.
if i move mouse to centralPanel the updates are reflected very quickly.
help me Plz
Thanx

Similar Messages

  • Problem in Swing Component (JComboBox)

    Hello i've got one amazing problem in my Swing Component (JComboBox) while testing for Glasspane..
    Please check this photo http://www.flickr.com/photos/39683118@N07/4483608081/
    Well i used Netbeans Drag n Drop Swing so the code might be messing..any way my code looks like this:
    My code looks like this:
    public class NewJPanel extends javax.swing.JPanel {
        /** Creates new form NewJPanel */
        public NewJPanel() {
            initComponents();
        /** 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.
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
            jTextField1 = new javax.swing.JTextField();
            jLabel1 = new javax.swing.JLabel();
            jLabel2 = new javax.swing.JLabel();
            jLabel3 = new javax.swing.JLabel();
            jButton1 = new javax.swing.JButton();
            jComboBox1 = new javax.swing.JComboBox();
            jCheckBox1 = new javax.swing.JCheckBox();
            setOpaque(false);
            jTextField1.setText("jTextField1");
            jLabel1.setText("jLabel1");
            jLabel2.setText("jLabel2");
            jLabel3.setText("jLabel3");
            jButton1.setText("jButton1");
            jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            jComboBox1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            jComboBox1.setNextFocusableComponent(jCheckBox1);
            jComboBox1.setOpaque(false);
            jComboBox1.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBox1ActionPerformed(evt);
            jCheckBox1.setText("jCheckBox1");
            jCheckBox1.setOpaque(false);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
            this.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap(119, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(jLabel3))
                    .addGap(51, 51, 51)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jButton1)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jCheckBox1)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(115, 115, 115))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(70, 70, 70)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1))
                    .addGap(15, 15, 15)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(jCheckBox1))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel3)
                        .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(jButton1)
                    .addContainerGap(93, Short.MAX_VALUE))
            jComboBox1.getAccessibleContext().setAccessibleParent(null);
        }// </editor-fold>
        private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
        // Variables declaration - do not modify
        private javax.swing.JButton jButton1;
        private javax.swing.JCheckBox jCheckBox1;
        private javax.swing.JComboBox jComboBox1;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JTextField jTextField1;
        // End of variables declaration
    }

    For more help create a [SSCCE (Short, Self Contained, Compilable and Executable, Example Program)|http://sscce.org], that demonstrates the incorrect behaviour.

  • How to set a Swing component as Modal on a SWT Component?

    How to set a Swing component as Modal on a SWT Componen?.I mean, I have a SWt Component window and from that window I am displaying a SWING Component Modal window.
    The problem is my swing window is not working as Modal always.
    When I opened the swing window from SWT window,swing window is working as Modal.But if Idouble click on Menubar or Title bar of the SWT Window then my Swing window goes back.If I click on any other part of the SWT window.. then once again Swing window is working as modal.
    Can any one suggest me to solve this?
    I think this is isuue related with Swing over SWT..

    pradeep.rajadurai wrote:
    I want set the JTable as a background of jframe or jinternalframe , how it is possible One way that may work, you can always extract the image from a rendered JTable and then paint the same image into the JPanel that holds your components via it's paintComponent method, then added the JPanel to the app's contentPane.
    give me simple pgmIs English your second language? Because if so, please understand that this demand can be taken by some as rude.

  • Painting Custom Component

    I am writing a custom Component inheriting from JComponent class. I am doing custom painting of this component as the component I want has to have a gradient background. I am able to draw the graphics properly. But I am having a problem with the positioning of the control. I read in the tutorial for the custom painting of JComponent that we should paint the component taking the base as 0. If I place my component any where on the panel other than (0,0) the component either gets displayed at 0,0 or is not getting displayed properly.Kindly provide me with a solution.

    Painting of the component and positioning of the component are two different things.
    Yes painting is done relative to the top left of the component which is (0, 0);
    Positioning of the component in a container is done by the Layout Manager. So you need to provide a getPreferredSize(...) implementation so the LayoutManager knows how much space to reserve for the component.
    Maybe the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/14painting/index.html]Custom Painting will help you out. There is also a section on "Using Layout Manager".
    If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
    And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

  • SwingUtilities.paintComponent - problems with painting childs of components

    Maybe this question was mention already but i cant find any answer...
    Thats what could be found in API about method paintComponent in SwingUtilities:
    Paints a component c on an arbitrary graphics g in the specified rectangle, specifying the rectangle's upper left corner and size. The component is reparented to a private container (whose parent becomes p) which prevents c.validate() and c.repaint() calls from propagating up the tree. The intermediate container has no other effect.
    The component should either descend from JComponent or be another kind of lightweight component. A lightweight component is one whose "lightweight" property (returned by the Component isLightweight method) is true. If the Component is not lightweight, bad things map happen: crashes, exceptions, painting problems...
    So this method perfectly works for simple Java components like JButton / JCheckbox e.t.c.
    But there are problems with painting JScrollBar / JScrollPane (only background of this component appears).
    I tried to understand why this happens and i think the answer is that it has child components that does not draw at all using SwingUtilities.paintComponent()
    (JScrollBar got at least 2 childs - 2 buttons on its both sides for scroll)
    Only parent component appears on graphics - and thats why i see only gray background of scrollbar
    So is there any way to draw something like panel with a few components on it if i have some Graphics2D to paint on and component itself?
    Simple example with JScrollPane:
    JScrollPane pane = new JScrollPane(new JLabel("TEST"));
    pane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    SwingUtilities.paintComponent(g2d, pane, new JPanel(), 0, 0, 200, 200);Edited by: mgarin on Aug 11, 2008 7:48 AM

    Well the thing you advised could work... but this wont be effective, because i call repaint of the area, where Components painted, very often..
    So it will lag like hell when i make 10-20 repaints in a second... (for e.g. when i drag anything i need mass repainting of the area)
    Isnt there any more optimal way to do painting of the sub-components?
    As i understand when any component (even complicated with childs) paints in swing - its paint method calls its child components paint() to show them... can this thing be reproduced to paint such components as JScrollPane?

  • Can't add to JPanel after removeAll() is triggered by another swing compone

    Consider the bit of code below. It's a much simplified version of my real app.
    In jPanel1 is a single label. In jPanel2 is a single button.
    The button in jPanel2 is supposed to wipe clear (with removeAll()) jPanel1 and add a new label in place of the old one. What actually happens is that after the first button press, jPanel1 is indeed cleared by the removeAll() method but the new label can't be added (or rather it can be added but won't show.) I can hard code the removal & addition back and forth all day & it works fine. It's just when I use a swing component like JButton or JComboBox that it doesn't work. Why?? Is this a thread thing? (I know I can just change the text of the label but the real app is much more complicated.)
    package my.stuff;
    import java.awt.*;
    import javax.swing.*;
    public class TreeTest3 extends javax.swing.JFrame {
         private String language = "english";
         public TreeTest3() {
              initComponents();
              jPanel1.setLayout(new FlowLayout());
              jPanel1.setVisible(true);
              changeLabel();
         private void changeLabel()
              System.out.println("language = " + language);
              jPanel1.removeAll();
              jPanel1.validate();
              jPanel1.add(new JLabel(language), "Center");
              repaint();
         @SuppressWarnings("unchecked")
            // <editor-fold defaultstate="collapsed" desc="Generated Code">
            private void initComponents() {
                    jPanel1 = new javax.swing.JPanel();
                    jPanel2 = new javax.swing.JPanel();
                    jButton1 = new javax.swing.JButton();
                    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
                    jPanel1.setBorder(new javax.swing.border.MatteBorder(null));
                    jPanel1.setPreferredSize(new java.awt.Dimension(400, 204));
                    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
                    jPanel1.setLayout(jPanel1Layout);
                    jPanel1Layout.setHorizontalGroup(
                            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGap(0, 398, Short.MAX_VALUE)
                    jPanel1Layout.setVerticalGroup(
                            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGap(0, 133, Short.MAX_VALUE)
                    jButton1.setText("switch");
                    jButton1.addActionListener(new java.awt.event.ActionListener() {
                            public void actionPerformed(java.awt.event.ActionEvent evt) {
                                    jButton1ActionPerformed(evt);
                    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
                    jPanel2.setLayout(jPanel2Layout);
                    jPanel2Layout.setHorizontalGroup(
                            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(jButton1)
                                    .addContainerGap(308, Short.MAX_VALUE))
                    jPanel2Layout.setVerticalGroup(
                            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addContainerGap()
                                    .addComponent(jButton1)
                                    .addContainerGap(126, Short.MAX_VALUE))
                    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
                    getContentPane().setLayout(layout);
                    layout.setHorizontalGroup(
                            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    layout.setVerticalGroup(
                            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    pack();
            }// </editor-fold>
         private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
              if (language.equals("english")) language = "spanish"; else language = "english";
              changeLabel();
         public static void main(String args[]) {
              java.awt.EventQueue.invokeLater(new Runnable() {
                   public void run() {
                        new TreeTest3().setVisible(true);
            // Variables declaration - do not modify
            private javax.swing.JButton jButton1;
            private javax.swing.JPanel jPanel1;
            private javax.swing.JPanel jPanel2;
            // End of variables declaration
    }

    It should be
                    private void changeLabel()
              System.out.println("language = " + language);
              jPanel1.removeAll();
              jPanel1.add(new JLabel(language), "Center");
              jPanel1.revalidate();
              jPanel1.repaint();
         }

  • Painting Child Component

    I have the following code for paintComponent() in a parent component.
        protected void paintComponent(Graphics g)
         if (registeredComponent != null)
             /*Create a copy of the Graphics context and
              ask the component to paint to it.*/
             Graphics2D image = (Graphics2D)g.create();
             registeredComponent.paint(image);
             image.dispose();
        }The problem that I have is that when I ask the registeredComponent to paint itself within its parent's graphics context, it paints under the parent's component border. I tried setting the clip area of the graphics context but with the same results. So I've left the original code here. The child component can be any Jcomponent, so I can't really alter the paintComponent() code within it.
    Any help please.

    I don't think anyone knows what registeredComponentOK, let me explain. The registeredComponent is a child component (which can be any JComponent).
    or why you don't paint the component
    itself or what it is you are actually trying to
    accomplish.The parent component really only paints its child components (I only have one right now) and does not have an image of its own. The parent component, however, does have a border, so all painting should be done inside of this border. That is, the border should not overlap the child component's image. The problem that I'm having is that the border overlaps the child component image. I tried setting the clip area but the same thing happens. That's what I'm trying to solve.
    is or why you are painting it to a copy of the
    graphics context About the copy of the Graphics context, that's just how the java 2d tutorial says to do it - make a copy, paint to it and then release it.
    protected void paintComponent(Graphics g)
    if (registeredComponent != null)
        /*Create a copy of the Graphics context and
         ask the component to paint to it.*/
        Graphics2D image = (Graphics2D)g.create();
        registeredComponent.paint(image);
        image.dispose();
        }

  • New: awt is covering my swing component...

    i am using both awt and swing component on the same page. They are a List and a JComboBox.
    while the JcomboBox is placed above the List. it works fine but when i click on the JComboBox, the pull down menu is covered by the awt List. I know that using JList can solve the problem, but i'm new to swing and i just want to make the smallest change to my code.
    can i use layeredpane to help?

    here is a link to the Swing tutorial that mentions this problem:
    http://java.sun.com/docs/books/tutorial/uiswing/start/swingIntro.html#awt
    The Swing tutorial also has a section on converting from AWT to Swing. You should look at that.
    Here is another article from the Swing Connection titled "Mixing Heavy and Light Components"
    http://java.sun.com/products/jfc/tsc/articles/mixing/index.html
    Like the previous post says, you are better off not to mix the two.

  • Swing component's opaque property

    Recenetly I read an article about "Painting in AWT and Swing" and feel confused about some points in the article.
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html
    The article mentioned several Swing Painting Guidelines, I have question about the following two paragraphs:
    6. If a Swing component's opaque property is set to true, then it is agreeing to paint all of the bits contained within its bounds (this includes clearing it's own background within paintComponent()), otherwise screen garbage may result.
    7. Setting either the opaque or optimizedDrawingEnabled properties to false on a component will cause more processing on each paint operation, therefore we recommend judicious use of both transparency and overlapping components.
    For the No.7, it's said setting the opaque to false will cause more process on each paint operation, I think it should changed to ture, since if set opaque property to true, it will paint all the bits contained within bounds as described in No.6.
    So is this an error? What on earth is efficient for the opaque property value?
    Thanks!

    For the No.7, it's said setting the opaque to false will cause more process on each paint operationWhen you create an application you do something like this:
    create a frame
    add a panel to the frame
    add a component to the panel. (lets say a JButton)
    When you click on a button you need to change the state of the button to look 'pressed'. So you need to repaint area on the screen where the button is painted.
    If the button is opaque(true) then you simply paint the button in its new state because the button is responsible for painting its background and any custom painting.
    if the button is opaque(false) then you don't paint the background which means you need to search for the parent of the button (in our example the panel). Once you find the parent you need to paint that area of the panel that the button overlays and then you do the custom painting of the button.
    So either way you have to repaint the same area. Hopefully it makes sense that painting a single component would be more efficient than painting parts of two separate components and determining which two components to repaint and what area to repaint of each component.

  • Flicker with heavyweight swing component and setVisible(false) on Linux

    Hi All,
    I'm using Java 6 update 14 on Ubuntu Jaunty.
    I'm developing a GUI for a system running linux. I'm using the Swing framework for the GUI but need to include 3D animation accelerated in hardware. I'm using the JOGL framework for applying the 3D animations which supplies one with two swing-like components, the GLJPanel and GLCanvas. These two components are lightweight and heavyweight swing components respectively.
    The difficulty arises when adding the heavyweight GLCanvas component into the gui. Often I need to do a setVisible(false) on the component in which case the GLCanvas hides correctly, but shows a flicker before the background is displayed. On digging a little deeper I found that because the GLCanvas is heavyweight, on linux it calls down to the sun.awt.X11 classes to do the setVisible(false) on hide. The very deepest call, the xSetVisible(false) method of the XBaseWindow class, causes the component to be replaced by first a grey backgound, and then the correct background. This intermediate grey background is causing the flicker.
    The source for the sun.awt.X11 packages was not available with the standard JDK 6 but I've found the open jdk source which matches the steps taken by the call. The xSetVisible method is as follows:
    0667:            public void xSetVisible(boolean visible) {
    0668:                if (log.isLoggable(Level.FINE))
    0669:                    log.fine("Setting visible on " + this  + " to " + visible);
    0670:                XToolkit.awtLock();
    0671:                try {
    0672:                    this .visible = visible;
    0673:                    if (visible) {
    0674:                        XlibWrapper.XMapWindow(XToolkit.getDisplay(),
    0675:                                getWindow());
    0676:                    } else {
    0677:                        XlibWrapper.XUnmapWindow(XToolkit.getDisplay(),
    0678:                                getWindow());
    0679:                    }
    0680:                    XlibWrapper.XFlush(XToolkit.getDisplay());
    0681:                } finally {
    0682:                    XToolkit.awtUnlock();
    0683:                }
    0684:            }I've found that the XlibWrapper.XFlush(XToolkit.getDisplay()) line (680) causes the grey to appear and then the XToolkit.awtUnlock(); line repaints the correct background.
    Using the lightwieght GLJPanel resolves this issue as it is a light weight component but unfortunately I'm unable to use it as the target system does not have the GLX 1.3 libraries required because of intel chipset driver issues (it has GLX 1.2). I cannot enable the opengl pipline either (-Dsun.java2d.opengl=True) for the same reason.
    Is there a way to configure a heavyweight component to avoid the operation in line 680? As far as I can tell, the flicker would disappear and the display would still be correctly rendered had this line not been executed. This problem is not present in windows.
    I've put together a minimal example of the problem. It requires the JOGL 1.1.1 libraries in the classpath. They can be found here: [JOGL-download|https://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=11509&expandFolder=11509&folderID=11508]
    I've also found that running the program with the -Dsun.awt.noerasebackground=true vm argument reduces the flicker to just one incorrect frame.
    The program creates a swing app with a button to switch between the GLCanvas and a normal JPanel. When switching from the GLCanvas to the JPanel a grey flicker is noticeable on Linux. Step through the code in debug mode to the classes mentioned above to see the grey flicker frame manifest.
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Insets;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.media.opengl.GLCanvas;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JPanel;
    import javax.swing.WindowConstants;
    import javax.swing.border.EmptyBorder;
    public class SwitchUsingJInternalFrameSwappedExample {
         private static JPanel glPanel;
         private static JPanel mainPanel;
         private static JPanel swingPanel1;
         private static boolean state;
         private static JInternalFrame layerFrame;
         private static GLCanvas glCanvas;
         public static void main(String[] args) {
              state = true;
              JFrame frame = new JFrame();
              frame.setSize(800, 800);
              frame.setContentPane(getMainPanel());
              frame.setVisible(true);
              frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
              frame.setBackground(Color.GREEN);
         // The main component.
         public static JPanel getMainPanel() {
              mainPanel = new JPanel();
              mainPanel.setBackground(new Color(0, 0, 255));
              mainPanel.setBorder(new EmptyBorder(new Insets(20, 20, 20, 20)));
              mainPanel.setLayout(new BorderLayout());
              mainPanel.add(getButton(), BorderLayout.NORTH);
              mainPanel.add(getAnimationPanel(), BorderLayout.CENTER);
              return mainPanel;
         // Switch button.
         private static JButton getButton() {
              JButton button = new JButton("Switch");
              button.addActionListener(new ActionListener() {
                   @Override
                   public void actionPerformed(ActionEvent e) {
                        switchToOpenGl();
              return button;
         // Do the switch.
         protected static void switchToOpenGl() {
              // Make the OpenGL overlay visible / invisible.
              if (!state) {
                   glCanvas.setVisible(false);
              } else {
                   glCanvas.setVisible(true);
              state = !state;
         // Normal swing panel with buttons
         public static JPanel getNormalPanel() {
              if (swingPanel1 == null) {
                   swingPanel1 = new JPanel();
                   for (int i = 0; i < 10; i++) {
                        swingPanel1.add(new JButton("Asdf" + i));
                   swingPanel1.setBackground(Color.black);
              return swingPanel1;
         // Extra panel container just for testing whether background colors show through.
         public static JPanel getAnimationPanel() {
              if (glPanel == null) {
                   glPanel = new JPanel(new BorderLayout());
                   glPanel.setBorder(new EmptyBorder(new Insets(20, 20, 20, 20)));
                   glPanel.setBackground(Color.YELLOW);
                   glPanel.add(getLayerFrame(), BorderLayout.CENTER);
              return glPanel;
         // A component that has two layers (panes), one containing the swing components and one containing the OpenGl animation.
         private static JInternalFrame getLayerFrame() {
              if (layerFrame == null) {
                   // Create a JInternalFrame that is not movable, iconifyable etc.
                   layerFrame = new JInternalFrame(null, false, false, false, false);
                   layerFrame.setBackground(new Color(155, 0, 0));
                   layerFrame.setVisible(true);     
                   // Remove the title bar and border of the JInternalFrame.
                   ((javax.swing.plaf.basic.BasicInternalFrameUI) layerFrame.getUI())
                             .setNorthPane(null);
                   layerFrame.setBorder(null);
                   // Add a normal swing component
                   layerFrame.setContentPane(getNormalPanel());
                   // Add the OpenGL animation overlay on a layer over the content layer.
                   layerFrame.setGlassPane(getGLCanvas());
              return layerFrame;
         // OpenGL component.
         public static GLCanvas getGLCanvas() {
              if (glCanvas == null) {
                   glCanvas = new GLCanvas();
                   glCanvas.setBackground(Color.CYAN);
              return glCanvas;
    }

    Oracle employees typically don't read these forums, you can report bugs here: http://bugs.sun.com/bugdatabase/

  • Problem related to PS CS6 ext. on Mac.  Nikon DSLR D610 raw file can not be opened

    Problem related to PS CS6 ext. on Mac. Installation is OK but I can't open picture from my Nikon D610 (Raw NEF format). I get a message "can not open this format ...". Checking Help menu to see if I miss an update the message I get is that I'm up-to-date but at the end Nikon D610 (format supported of course) files can not be opened . JPEG are OK but I work with raw files. Thanks

    What OS are you running: 10.x.x?
    What version of the Camera Raw plug-in do you have?  Do (About) Plug-ins / Camera Raw to find out.
    You need at least ACR 8.3 to open D610 files.  If the Help / Updates process does not work, then there is a manual install process you can do.  The page with the download is for when people accidentally updated to ACR 8.4 and need to roll back to ACR 8.3 due to their OS being incompatible, but the installer on that page works even if you haven’t erroneously updated to ACR 8.4:
    http://helpx.adobe.com/x-productkb/multi/camera-raw-84-support-policy.html

  • Problem with java swing button and loop

    Problem with java swing button and loop
    I�m using VAJ 4.0. and I�m doing normal GUI application. I have next problem.
    I have in the same class two jswing buttons named start (ivjGStart) and stop (ivjGStop) and private static int field named Status where initial value is 0. This buttons should work something like this:
    When I click on start button it must do next:
    Start button must set disenabled and Stop button must set enabled and selected. Field status is set to 1, because this is a condition in next procedure in some loop. And then procedure named IzvajajNeprekinjeno() is invoked.
    And when I click on stop button it must do next:
    Start button must set enabled and selected and Stop button must set disenabled.
    Field status is set to 0.
    This works everything fine without loop �do .. while� inside the procedure IzvajajNeprekinjeno(). But when used this loop the start button all the time stay (like) pressed. And this means that a can�t stop my loop.
    There is java code, so you can get better picture:
    /** start button */
    public void gStart_ActionEvents() {
    try {
    ivjGStart.setEnabled(false);
    ivjGStop.setEnabled(true);
    ivjGStop.setSelected(true);
    getJTextPane1().setText("Program is running ...");
    Status = 1;
    } catch (Exception e) {}
    /** stop button */
    public void gStop_ActionEvents() {
    try {
    ivjGStart.setEnabled(true);
    ivjGStart.setSelected(true);
    ivjGStop.setEnabled(false);
    getJTextPane1().setText("Program is NOT running ...");
    Status = 0;
    } catch (Exception e) {
    /** procedure IzvajajNeprekinjeno() */
    public void IzvajajNeprekinjeno() {  //RunLoop
    try {
    int zamik = 2000; //delay
    do {
    Thread.sleep(zamik);
    PreberiDat(); //procedure
    } while (Status == 1);
    } catch (Exception e) {
    So, I'm asking what I have to do, that start button will not all the time stay pressed? Or some other aspect of solving this problem.
    Any help will be appreciated.
    Best regards,
    Tomi

    This is a multi thread problem. When you start the gui, it is running in one thread. Lets call that GUI_Thread so we know what we are talking about.
    Since java is task-based this will happen if you do like this:
    1. Button "Start" is pressed. Thread running: GUI_Thread
    2. Event gStart_ActionEvents() called. Thread running: GUI_Thread
    3. Method IzvajajNeprekinjeno() called. Thread running: GUI_Thread
    4. Sleep in method IzvajajNeprekinjeno() on thread GUI_Thread
    5. Call PreberiDat(). Thread running: GUI_Thread
    6. Check status. If == 1, go tho 4. Thread running: GUI_Thread.
    Since the method IzvajajNeprekinjeno() (what does that mean?) and the GUI is running in the same thread and the event that the Start button has thrown isn't done yet, the program will go on in the IzvajajNeprekinjeno() method forever and never let you press the Stop-button.
    What you have to do is do put either the GUI in a thread of its own or start a new thread that will do the task of the IzvajajNeprekinjeno() method.
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    This tutorial explains how to build a multi threaded gui.
    /Lime

  • HT4623 Is this the most up to date article on up dating the iPhone - it there anything about the problems relating to the up date to OS 6 - my G3 no longer works and Apple seems to have gone to ground.  No Genius bar appointments available for a week!

    Is this the most up to date article on up-dating the iPhone OS - is there anything about the problems relating to the up-date to OS 6 - my G3 no longer works and Apple seems to have gone to ground.  No Genius bar appointments available for a week!

    iOS 7 devices need iTunes 11.1 or newer to sync.  Depending upon your computer and the OS it is running, you may not be able to upgrade to iTunes 11.1 based on the requirements for iTunes 11.1.  What computer and OS are you running your iTunes on?  From the iTunes download pages I see the requiorements are:
    Macintosh System Requirements
    Mac computer with an Intel Core processor
    OS X version 10.6.8 or later
    400MB of available disk space
    Broadband Internet connection to use the iTunes Store
    Windows System Requirements
    PC with a 1GHz Intel or AMD processor and 512MB of RAM
    Windows XP Service Pack 2 or later, 32-bit editions of Windows Vista, Windows 7, or Windows 8
    64-bit editions of Windows Vista, Windows 7, or Windows 8 require the iTunes 64-bit installer
    400MB of available disk space
    Broadband Internet connection to use the iTunes Store

  • Help-using document as a java swing component

    Hi,
    can i use a document excel file or a doc file as a swing component.
    i have few templates in in excel and .doc format.
    i use them to produce bills by just entering data.
    Now i want to develop a swing application and use the same templates in jpanel or jtextpane or jeditorpane.
    its very hectic to make templates in swing using tables and all.
    is there any api which can help me out???
    thanks

    as a Swing component? No.
    There's probably libraries for reading those types of files, and maybe displaying them. POI, perhaps?

  • The problem related to wireless service Wi-Fi connectivity Never work properly

    Hi
    i am bashair from KSA
    I have iPhone 5, you update your iPhone to version 6.1.3
    The problem related to wireless service Wi-Fi connectivity
    Never work properly, you try Method posed but did not succeed..
    i need help me please
    thanks..

    UPDATE
    Hey this is totally weird. I haven't done jailbreak at all and I won't But how is possible that default apps such as Safari and Appstore have the problem I've mentioned before and Skyfire works perfectly without any trouble.
    So to sum up:
    Safari: loading stucks after few seconds on wi-fi, mostly doesn't load pictures
    Appstore: loading stucks after few seconds on wifi and it keeps saying "loading"
    Facebook and Youtube: doesn't load pictures
    SKYFIRE: loads everything without any trouble
    and completely everything works on Edge...
    So tell me W.T.F. :-D

Maybe you are looking for

  • Firefox opens but will not search for main page

    After upgrading to Fiefox 4.01, when I open firefox and I type in the search bar that appears in the middle of the page it won't search. It does nothing. I can go to the top-right bar which is currently using yahoo search engine, type and it will sea

  • IP ADDRESSING FOR THREE SITES .

    HELLO, I AM HAVING THREE SITES HEAD OFFICE WITH ROUTER,FIREWALL,SWITCHES,SERVERS & PC'S AROUND 80-120 NODES. TWO REMOTE SITES WITH ROUTER,SWITCH & PC'S AROUND 40-50 EACH SITE. AND ONE WAREHOUSE WITH THREE PC'S. PLEASE HELP ME WHICH CLASS IP'S TO USE.

  • Initialize Jtable in Edit Mode without clicking mouse

    I am writing an inventory software where I need JTable to start in edit mode in my invoicing dialogue. Here is the code I tried (which is not working): ProductsGrid.setRowSelectionInterval(0, 0); ProductsGrid.setColumnSelectionInterval(0,0); Products

  • How to prevent video playback from getting paused when switching to another tab on Firefox for Android?

    In Firefox for Android 27.0, if you play video in one tab and while it's playing you switch to another tab, the video gets paused. I want the video to continue to play while I'm viewing another tab (so I can at least hear its sound!). How can I do th

  • Nokia 822 People 'Listing' Issue

    I am trying to sort my contacts in 'People' by Last Name, First without success. I have selected both  'Sort by Last Name', and 'Display names by Last, First' and the list still displays as 'First, Last'.  I double-checked my entries to make sure the