Db swing components

Installed jDeveloper, connected to 9i, looks good. But, noticed the component pallette does not include any db component that can be dropped on a standard swing app. Now I remember trying forte and netbeans freebees and recall they lacked db component as well, which greatly limits these IDEs.
Would like to see a canned db bean aka:jBuilder, where are they?

I'm back a couple versions, but in 3.2.3 (really only two versions earlier than what you have), they are called "Info Swing" components. Other key words are "BC4J" (Business Components for Java), which provides the whole database interaction / caching / locking layer for you.
In a nutshell, you build the BC4J components on top of your database,
then in your swing application you add an "info provider" (which points at a BC4J object), and then you add an "info swing" component, like a text box (etc.), which you tie to the info provider. Coming from Oracle Forms I was thrown by the four layer process to build a simple database form. And you really really need to start from the bottom (database) and work up, IMO.
It is there - maybe just a terminology problem (I can sympathize!!!).

Similar Messages

  • Swing components in applet not working in web browser

    Hi Guys,
    I've created an applet which makes use of some swing components, but unfortunately, not all of them function properly in my web browser (internet explorer or Mozilla Firefox). Its mainly the buttons; the last buttons works and displays the correct file within the broswer, but the first 5 buttons do not work...
    any help please on how I can sort this problem out?
    Heres the code for my applet:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.applet.*;
    public class MainAppWindow extends JApplet
    int gapBetweenButtons = 5;
    final JPanel displayPanel = new JPanel(new BorderLayout());
    public void init()
       //Panel for overall display in applet window.
       JPanel mainPanel = new JPanel(new BorderLayout());
       mainPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/smalllogo2.gif"))),BorderLayout.NORTH);
       //sub mainPanel which holds all mainPanels together.
       JPanel holdingPanel = new JPanel(new BorderLayout());
       //Panel for displaying all slide show and applications in.
       displayPanel.setBackground(Color.white);
       displayPanel.add(new JLabel(new ImageIcon(getClass().getResource("images/IntroPage.jpg"))),BorderLayout.CENTER);
       displayPanel.setPreferredSize(new Dimension(590,400));
       JPanel buttonPanel = new JPanel(new GridLayout(6,1,0,gapBetweenButtons));
       buttonPanel.setBackground(Color.white);
       JButton button1 = new JButton("User guide");
       button1.addActionListener(
         new ActionListener() {
              public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll(); // If there are any components in the mainPanel, remove them and then add label
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/UserGuide.jpg")));
                   displayPanel.revalidate(); // Validates displayPanel to allow changes to occur onto it, allowing to add different number images/applicaions to it.
       JButton button2 = new JButton("What is a Stack?");
       button2.addActionListener(
       new ActionListener() {
               public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/WhatIsAStack.jpg")));
                   displayPanel.revalidate();
       JButton button3 = new JButton("STACK(ADT)");
       button3.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StackADT.jpg")));
                   displayPanel.revalidate();
       JButton button4 = new JButton("Stacks in the Real World");
       button4.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                   if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                   displayPanel.setBackground(Color.white);
                   displayPanel.add(new JLabel(new ImageIcon("images/StacksInTheRealWorld.jpg")));
                   displayPanel.revalidate();
       JButton button5 = new JButton("DEMONSTRATION");
       button5.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                 if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                 Demonstration app = new Demonstration();
                 JPanel appPanel = app.createComponents();//gets the created components from Demonstration application.
                 appPanel.setBackground(Color.pink);
               displayPanel.add(appPanel);
               displayPanel.revalidate();
       JButton button6 = new JButton("Towers Of Hanoi");
       button6.addActionListener(
       new ActionListener() {
             public void actionPerformed(ActionEvent e)
                     if(displayPanel.getComponents().length > 0)displayPanel.removeAll();
                     TowerOfHanoi app = new TowerOfHanoi();
                     JPanel appPanel = app.createComponents();//gets the created components from Towers of Hanoi
                     JPanel mainPanel = new JPanel();//panel used to centralise the application in center
                     mainPanel.add(appPanel);
                     mainPanel.setBackground(Color.pink); //sets mainPanel's background color for 'Towers Of Hanoi'
                     displayPanel.add(mainPanel);
                     displayPanel.revalidate();
       //adding buttons to the buttonPanel.
       buttonPanel.add(button1);
       buttonPanel.add(button2);
       buttonPanel.add(button3);
       buttonPanel.add(button4);
       buttonPanel.add(button5);
       buttonPanel.add(button6);
       JPanel p = new JPanel(); // Used so that the buttons maintain their default shape
       p.setBackground(Color.white);
       p.add(buttonPanel);
       holdingPanel.add(p,BorderLayout.WEST);
       holdingPanel.add(displayPanel,BorderLayout.CENTER);
       //Positioning of holdingPanel in mainPanel.
       mainPanel.add(holdingPanel,BorderLayout.CENTER);
       //indent mainPanel so that its not touching the applet window frame.
       mainPanel.setBorder(BorderFactory.createEmptyBorder(10,20,10,20));
       mainPanel.setBackground(Color.white);
       mainPanel.setPreferredSize(new Dimension(850,600)); //size of applet window
       mainPanel.setOpaque(false); // Needed for Applet
       this.setContentPane(mainPanel);
    }

    Thanks for the response. I don't quite understand what you're talking about though. I have, in my humble knowledge, done nothing with packages. I have put the applet class (WiaRekenToolActiz.class is the applet class) in the jar file wia_actiz_archive.jar. From what I read on the tutorial, java looks for the applet class in all the jar files specified. Since I put my CODEBASE as the main url, I thought it baiscally didn't matter where you out the html file.
    I shall include the complete html page complete with applet tag to perhaps illuminate a bit more what I mean...
    <html>
    <head>
    <title>Wia Rekenmodule hello!</title>
    </head>
    <body bgcolor="#C0C0C0">
    <applet
    CODEBASE= "http://www.creativemathsolutions.nl/test"
    ARCHIVE= "Actiz/wia_actiz_archive.jar, Generic/wia_archive.jar"
    CODE="WiaRekenToolActiz.class" 
    WIDTH=915 HEIGHT=555
    >
    <PARAM NAME = naam VALUE = "Piet Janssen">
    <PARAM NAME = gebdag VALUE = "01">
    <PARAM NAME = gebmaand VALUE = "06">
    <PARAM NAME = gebjaar VALUE = "1970">
    <PARAM NAME = geslacht VALUE = "man">
    <PARAM NAME = dienstjaren VALUE = "10">
    <PARAM NAME = salaris VALUE = "56500">
    <PARAM NAME = deeltijdpercentage VALUE = "100">
    <PARAM NAME = accountnaam VALUE = "Zorginstelling 'De Zonnebloem'">
    </applet>
    </body>
    </html>

  • I can't use swing components in my applets

    When I write an applet without any swing components, my browser never has any trouble finding the classes it needs, whether they're classes I've written or classes that came with Java. However, when I try to use swing components it cannot find them, because it is looking in the wrong place:
    On my computer I have a directory called C:\Java, into which I installed my Java Development Kit (so Sun's classes are stored in the default location within that directory, wherever that is), and I store my classes in C:\Java\Files\[path depends on package]. My browser gives an error message along the lines of "Cannot find class JFrame at C:\Java\Files\javax\swing\JFrame.class"; it shouldn't be looking for this non-existent directory, it should find the swing components where it finds, for example, the Applet class and the Graphics class.
    Is there any way I can set the classpath on my browser? Are the swing components stored separately from other classes (I'm using the J2SE v1.3)?
    Thanks in advance.

    Without having complete information, it appears that you are running your applets using the browser's VM. Further, I assume you are using either IE or Netscape Navigator pre-v6. In that case, your browser only supports Java 1.1, and Swing was implemented in Java 1.2. You need to use the Java plug-in in order to use the Swing classes (see the Plug-in forum for more information), or else download the Swing classes from Sun and include them in your CLASSPATH.
    HTH,
    Carl Rapson

  • Need help with using graphics in swing components

    Hi. I'm new to Java and trying to learn it while also developing an application for class this semester. I've been following online tutorials for about 2 months now, though, and so I'm not sure my question counts as a "new to Java" question any more as the code is quite long.
    Here is the basic problem. I started coding the application as a basic awt Applet (starting at "Hello World") and about a month in realized that Swing components offer better buttons, panels, layouts, etc. So I converted the application, called BsfAp, to a new JApplet and started adding JPanels and JComponents with layout managers. My problem is, none of the buffered graphics run in any kind of JPanel, only the buttons do. I assume the buffered graphics are written straight to the JApplet top level container instead but I'm not entirely sure.
    So as to not inundate the forum with code, the JApplet runs online at:
    http://mason.gmu.edu/~dho2/files/sensor.html
    The source code is also online at:
    http://mason.gmu.edu/~dho2/files/BsfAp.java
    What I would like to do is this - take everything in the GUI left of the tabbed button pane and put it into a JScrollPane so that I can use a larger grid size with map display I can scroll around. The grid size I would like to use is more like 700x1000 pixels, but I only want to display about 400x400 pixels of it at a time in the JScrollPane. Then I could also move this JScrollPane around with layout manager. I think this is possible, but I don't know how to do it.
    I'm sure the code is not organized or optimized appropriately to those of you who use Java every day, but again I'm trying to learn it. ;-)
    Thanks for any help or insight you could provide in this.
    Matt

    Couple of recs:
    * Don't override paint and paint directly on the JApplet. Paint on a JPanel and override paintComponent.
    * The simplest way to display a graphic is to put an image into an ImageIcon and show this in a JLabel. This can then easily go inside of the JScrollPane.
    * You can also create a graphics JPanel that overrides the paintComponent, draw the image in that and show that inside of the JScrollPane.
    * don't call paint() directly. Call repaint if you want the graphic to repaint.
    Here's a trivial example quickly put together:
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.FlowLayout;
    import java.awt.GradientPaint;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Paint;
    import java.awt.RenderingHints;
    import java.awt.geom.Ellipse2D;
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.SwingUtilities;
    public class BsfCrap extends JApplet
        private JPanel mainPanel = new JPanel();
        private JScrollPane scrollPane;
        private JPanel graphicsPanel = new JPanel()
            @Override
            protected void paintComponent(Graphics g)
                super.paintComponent(g);
                Graphics2D g2d = (Graphics2D)g;
                RenderingHints rh = new RenderingHints(
                    RenderingHints.KEY_ANTIALIASING,
                    RenderingHints.VALUE_ANTIALIAS_ON);
                g2d.setRenderingHints(rh);
                Paint gPaint = new GradientPaint(0, 0, Color.blue,
                    40, 40, Color.magenta, true);
                g2d.setPaint(gPaint);
                g2d.fill(new Ellipse2D.Double(0, 0, 800, 800));
        public BsfCrap()
            mainPanel.setPreferredSize(new Dimension(400, 400));
            mainPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
            graphicsPanel.setPreferredSize(new Dimension(800, 800));
            graphicsPanel.setBackground(Color.white);
            scrollPane = new JScrollPane(graphicsPanel);
            scrollPane.setPreferredSize(new Dimension(300, 300));
            mainPanel.add(scrollPane);
        public JPanel getMainPanel()
            return mainPanel;
        @Override
        public void init()
            try
                SwingUtilities.invokeAndWait(new Runnable()
                    public void run()
                        setSize(new Dimension(400, 400));
                        getContentPane().add(new BsfCrap().getMainPanel());
            catch (InterruptedException e)
                e.printStackTrace();
            catch (InvocationTargetException e)
                e.printStackTrace();
    }

  • I'd like to make a list of interactive Swing components....

    EDIT: I've been doing more research about Layout Managers and it appears that BoxLayout may provide me with the solution I need. I'll mess around with it for awhile and report back if I still need help. Thanks pals!+
    I would like to make a list of JPanels laid out in basically a column. One on top of the other. That's not so difficult, but I need to make it able able to add and remove panels in response to user-driven events (in other words, I can't just hard-code them all, and the panels are generated on the fly, so I don't even know how many I'll need to be displaying until I need to display them.
    Here's a simple mockup of the window I'm talking about.
    |      - o x |
    |____________|
    |            |
    |            |
    |   Panel1   |
    |   Panel2   |
    |   Panel3   |
    |   Panel4   |
    |____________|At first, I thought a JList would serve my purpose, but you can't add interactive Swing components to JLists (or JTables)... they'll render, but that's all. My panels will contain a button and a checkbox, so this is a no-go.
    I was also thinking I could just manage the placement with GridBagLayout and just keep indexes for the current y position, but if there's an easier way, I'd rather not go this route. It has me writing a lot of extra code and manipulating a lot of fields of GridBagConstraints, which opens me to less-understandable code and more error-prone code, on account of I'm great at making little mistakes when I'm setting craploads of constraints.
    Does anyone have any ideas? It'd be ideal if there was just some sort of container I could plop them in with add and remove methods (a la JTabbedPane or something).
    I'm pretty new to Swing, so maybe I'm missing something obvious.
    Edited by: Caryy on Sep 30, 2010 4:15 PM

    I would recommend using BoxLayout or Box.createVerticalBox(). As mKorbel already mentioned, you need to call revalidate() after adding any component to an already realized/visible container, and additionally call repaint() after removing a component. To resize the top level window to accommodate its new content, you would call pack(). Or, again as suggested by mKorbel, wrap your panel/Box in a JScrollPane.
    db

  • Showing swing components in the palette og jdeveloper

    hello, I have found a problem with jdeveloper, as a user uses jdeveloper since 2 years I have never found a problem like this. (IDE problem).
    like habitude I created a simple java project which contains a jframe and an entry class (main class), but when I try to drag and drop from the component palette somes swing components I didn't find
    the page of swing components ( I found in the components palette just "my components" page in the jcombobox selection category). this problem will delay a big project and causes big problems
    please any person who know some things help me as soon as possible.
    Best Regards.

    Check this post -
    showing palette containing JButton,JLabel,JPanel ... components

  • About the difference between the AWT components and the swing components

    As we know that an AWT component has a peer, but dose a lightweight component(e.g: a swing component) has also a peer? And could somebody tell me that who and how creates the CLICKED_EVENT when I click a JButton(a swing component), and where the CLICKED_EVENT to go util it was processed by a method like btn_ok_clicked(Event e)? And if I click a Button(an AWT component), what's the difference?
    Thanks a lot!

    The main difference is that AWT are native components, and Swing components are entirely in java written. That's besides the look and feel. There are a lot of other differences between AWT and Swing, and there are better described in the documentation.

  • Multifont output in Swing components

    Hi there,
    though I'm not new to Java but I'm new to displaying different fonts in Swing components.
    I have an Swing-based application which is running on a Terminal Server. It works fine for Central, Western und Northern Europe. The next
    country to roll out is Greece. So what does a greek user see on his monitor when he uses his greek keyboard?
    I am writing a test app where I type german text into a JTextField and want to get e.g. the greek representation in another JTextField. How can I achieve this? Converting the bytearray with Cp1253 did not work
    Can anybody give me a hint?
    Thanks
    Dierk.

    as I wrote, it is a test app to learn how I get greek
    fonts on the screen. Of course the real app is used by
    greek users who put greek text into the system. In the
    system we do not use resource bundles as the GUI texts
    are stored in the database. It is a CMS for product
    information in different languages.Ah, I see... mind you, I don't think your German text would have a great deal of Cyrillic characters in them, right? Still, it's only a test! ;-)
    Now what I'm doing to get my german text in greek
    letters is this:
    utf8Bytes =
    = getorigTextField().getText().getBytes("UTF16");
    isr = new InputStreamReader(new
    w ByteArrayInputStream
    (utf8Bytes), "Cp1253");
    As far as I understand, the InputStreamReader gives
    the translation
    of my german letters in the encoding of CP1253
    (Windows Greek). That
    means the unicode characters change into the ones of
    the greek language
    so I should be able to show them in a Swing component.This is where your problem is. Java's Strings will always be in UTF-16 when they are held internally. So anything within a textfield is going to be UTF-16 no matter what you do with it.
    The line you think is converting to Cp1253 is actually trying to convert from Cp1253 to UTF-16.
    Hopefully this is the reason your characters aren't appearing - the unneeded conversion above could be mashing them. Instead, you need expect everything to always be in UTF-16, and to expect to display in it (don't worry, it handles any character you can throw at it, let alone Greek). So then it all comes down to the font you're using.
    I'm not too sure of the name of the Windows default Cyrillic font, but that would be a logical starting point.
    Hope that helps!
    Martin Hughes

  • Hindi Numerals and Hejri calender in swing components

    Hi
    Are Hindi numerals and Hejri calender supported in JDK 1.4 swing components or not?
    Please I need this as soon as possible.
    Thanks in advance
    Marwa Aboulfadl

    hello!
    I am developing an arabic editor but i am unable to display the arbic numeric in swing text .Plz help me on this topic and send some code example on this topic.
    I have another problem about events i.e how can i handle the beckspace event, enter event, and spaceevent?
    plz send me mail .
    Thanx for advance.

  • Swing components not displaying correctly in JApplet

    Hello everyone,
    I have experienced some strange problems using Swing components on JApplets. Maybe I missed some documentation somewhere and someone can help me out.
    The problem is that when I add components like JButtons,
    JCheckboxes, JRadioButtons, JTextFields, JPasswordFields,
    and JComboBoxes to JApplets, when I view the applet, the
    component does not become visible until I move the mouse
    pointer over it in the case of buttons. For the JComboBox I have
    to hit the mouse key many times on the component to see the list. Has anyone experienced problems like these? Thanks.
    Keith

    check what is in ur paint(Graphic g) method. if it does nothing, remove the paint(Graphic g) method. if it has some codes, double check ur codes.

  • Swing Components not displaying in a JFrame

    Hi,
    I have a JFrame with a couple of JLabels, JButtons etc. and a Choice Combo Box
    my problem is that when i run the program the only component that gets displayed at first is Choice and in order for me to see the swing components i have to roll over them with my mouse and the JLabels dont even display when i do that..
    Does anyone know how i can fix this please?
    here is my code
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.*;
    import java.awt.Image.*;
    import java.io.*;
    import java.net.*;
    public class ImageViewerAnim extends JFrame {
         private JLabel perc, scale;
         private JTextField inPercent;
         private JButton draw, muteOn;
         private JPanel sPanel;
         private String[] pics = {"Earth", "Moon", "Jupiter", "Pluton", "Neptun"};
         private String[] picsFile = {"images/earth.gif", "images/moon.gif", "images/jupiter.jpg", "images/pluton.jpg", "images/neptun.jpg"};
         private String[] soundsFile = {"sounds/tada.wav", "sounds/notify.wav", "sounds/ding.wav", "sounds/chimes.wav", "sounds/chimes.wav"};
         private Choice ch;
         private Image pic;
         private AudioClip sound = null;
         private int scaleAm = 0;
         private int origScale = 500;
         private int finalScale = 0;
         private boolean proceed = true;
         public ImageViewerAnim() {
              Container c = getContentPane();
              c.setLayout(new BorderLayout());
              sPanel = new JPanel();
              ch = new Choice();
              for(int i = 0; i < pics.length; ++i) {
                   ch.add(pics);
              scale = new JLabel("Scale");
              perc = new JLabel("%");
              inPercent = new JTextField(5); // scale value input field
              draw = new JButton("Draw");
              draw.setBorder(BorderFactory.createEtchedBorder());
              draw.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        int index = 0;
                        index = ch.getSelectedIndex();
                        pic = null;
                        repaint();
                        pic = (Toolkit.getDefaultToolkit().getImage(picsFile[index]));
                        try{
                        File f = new File(soundsFile[index]);
                        sound = Applet.newAudioClip(f.toURL());
                        }catch(MalformedURLException mfe) {
                             mfe.printStackTrace();
                        if(!inPercent.getText().equals("")) {
                             scaleAm = Integer.parseInt(inPercent.getText()); // get the scale amount from the user
                             finalScale = ((origScale * scaleAm)/100); // calculate the final scale amount based on what the user entered
                        }else {
                             finalScale = origScale; // default to original size of the image if no value for scale was entered
                        // creates a scaled instance of an image and takes the amount of scale as an argument
                        repaint();
                        sound.loop();
              muteOn = new JButton("Mute On");
              muteOn.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        sound.stop();
                        muteOn.setText("MuteOff");
              sPanel.add(ch);
              sPanel.add(scale);
              sPanel.add(inPercent);
              sPanel.add(perc);
              sPanel.add(draw);
              sPanel.add(muteOn);
              c.add(sPanel, BorderLayout.SOUTH);
              repaint();
    public void paint(Graphics g) {
         if(pic!=null) {
              g.drawImage(pic,0,0,this);
    public static void main(String args[]) {
         ImageViewerAnim app = new ImageViewerAnim();
         app.setSize(500,500);
         app.setVisible(true);
         app.setDefaultCloseOperation(EXIT_ON_CLOSE);
         app.show();
    thank you in advance
    Ivo

    for future reference
    i was able to fix this by adding
    super.paint(g);in the first line of my paint method
    Ivo

  • Rendering of Swing components

    Hi,
    As the renderer is used to be client independant, is it suitable to send back to the client a serialized view of Swing components (using the new XML serialization format) ?
    This could allow server-side management of the client's look-and-feel and total move of the business on the server.
    It might sounds weird and I'm not totally clear with myself anyway.
    I think a little "deamon" should handle the requests to the server and the demarshalling step of the server response.
    Any point of view on this ?
    (this is just a thought of an alternative use of the renderer capabilities coz todays it only sends back HTML tags)
    Ionel

    Hi,
    personally, I do not have too much experience with Swing.
    There is a project on sourceforge that implements your idea but is not based on Java Server Faces.
    It's called SwingML:
    swingml.sourceforge.net

  • Issue viewing Swing components

    I currently am able to compile, but not view Swing components. I am running Windows Media Center Edition with Radeon X300 graphics card. Swing programs execute but I only see the border window with only grey content inside. I have 1gb of memory and have tried running very small applications with the same effect. Does Java not support my OS? Any ideas?

    Some sample code follows that doesn't work for me
    At odd times I can see some of the swing applications I try to run, but it isn't consistent. This makes me think it is a memory problem, but I'm not sure. The following application takes 19,040 K with 373688 K available physical memory.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class DefaultButton {
    public static void main(String args[]) {
    Runnable runner = new Runnable() {
    public void run() {
    JFrame frame = new JFrame("DefaultButton");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setLayout(new GridLayout(2, 2, 10, 10));
    JButton button1 = new JButton("Text Button");
    button1.setMnemonic(KeyEvent.VK_B);
    frame.add(button1);
    Icon warnIcon = new ImageIcon("Warn.gif");
    JButton button2 = new JButton(warnIcon);
    frame.add(button2);
    JButton button3 = new JButton("Warning", warnIcon);
    frame.add(button3);
    String htmlButton = "<html><sup>HTML</sup> <sub><em>Button</em></sub><br>" +
    "<font color=\"#FF0080\"><u>Multi-line</u></font>";
    JButton button4 = new JButton(htmlButton);
    frame.add(button4);
    JRootPane rootPane = frame.getRootPane();
    rootPane.setDefaultButton(button2);
    frame.setSize(300, 200);
    frame.setVisible(true);
    EventQueue.invokeLater(runner);
    }

  • How to list/access swing components?

    hi all,
    Can anyone give me a clue, how can I access or simply list swing components I have on a frame, long after I created them. E.g. I'd like to change their setEnabled() attribute at a later time, not at creation time, but I don't know how to access them.
    Does Swing/AWT/JFC provides a component hierarchy? can someone share some code on this issue?
    Thanks for any help.
    Thomas

    I guess, you are saying the use of getComponent(int n)?
    Since I'm a beginner in Swing see my short code below:
    import java.awt.BorderLayout;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JTextArea;
    public class EasyFrame {
        public EasyFrame() {
            super();
            startHere();
        public void startHere() {
            JFrame frame = new JFrame("SwingApplication");
            JButton button = new JButton("click here");
            JTextArea area = new JTextArea();
            frame.setSize(300, 200);
            frame.getContentPane().setLayout(new BorderLayout());
            frame.getContentPane().add(area, BorderLayout.CENTER);
            frame.getContentPane().add(button, BorderLayout.SOUTH);
            area.setText("Hello World");
            JMenuBar menuBar = new JMenuBar();
            JMenu menu = new JMenu("A Menu");
            menuBar.add(menu);
            JMenuItem menuItem = new JMenuItem("A text item");
            menu.add(menuItem);
            menu.addSeparator();
            menuItem = new JMenuItem("hello");
            menu.add(menuItem);
            JMenu subMenu = new JMenu("submenu");
            menuItem = new JMenuItem("sub1");
            subMenu.add(menuItem);
            menuItem = new JMenuItem("sub2");
            subMenu.add(menuItem);
            menu.add(subMenu);
            frame.getContentPane().add(menuBar, BorderLayout.NORTH);
            frame.show();
         public static void main(String[] args) {
         EasyFrame ef = new EasyFrame();
    }If I make a System.out.println(frame.getContentPane().getComponentCount());I get 3. But I should dig deeper (with getComponent(2)) to access JMenuBar. But this way I receive a AWT Component / not a JMenuBar Swing component to get its JMenu / and its JMenuItems. And I cannot make it cast to JMenuBar since this walk-through routine should be a universal while(isThereMoreCompenent){} procedure, I don't know when to cast to what (JMenu, JMenuItem, Button and so on).
    My problem is that how can I access the JMenuItems one by one, and change e.g. the setEnabled attribute of the "hello" menu?
    I hope you can make it clear to me.
    Please help if so.

  • How to improve the Performance of Swing Components

    Hi
    I have developed a GUI Framework with Swing components. I observed that when number of components are more, the GUI is slow. Could anybody suggest me the ways to improve the performance of Swing Components
    Thanks

    Hi There - I haven't found issues so far with the speed of the GUI building, it seems fast when compared with .NET applications
    Are you doing any database querying on form load? This can slow down the loading of the GUI, I use persistence in an application and before the GUI is shown the persistence unit logs in to the database and registers itself - it does take 2/3 seconds to register and complete whatever it does before the form builds and shows
    Also check if you are loading/using any network based files on form load, this can also slow down the building considerably as well. Apart from that it's hard to say where your issue may lie apart from removing controls and checking build speed until you find the one that's slowing it down (not a good approach though) I sometimes had to load csv files from a network drive and if the file server is slow or LAN speed isn't great this can also cause a delay, hope you find it.....

  • Using Swing Components in JSP

    Hi,
    I regret that I do not have a very specific problem here. However, I am wondering if there is a way to display Swing components, such as a panel, on a web page using JSP. If so, are there any tutorials on such a practice? Or would something like this be included in a general tutorial?
    Thanks,
    Dan

    You'll have to use a JApplet.

Maybe you are looking for

  • How to tell how many times a method has executed?

    Hi, all I've got a main class (Model.java) that repeatedly calls a step() method in a sub class (Ocean.java). I want Ocean.java to execute its step() method following one set of rules for the first time it is called by Model.java, and a different set

  • Illegal use of nonvirtual function call

    I'm trying to run this program.... import java.io.*; import java.util.*; import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; import sun.net.nntp.*; import lotus.domino.*; public class WriteNewsFile implements Constants{   

  • Error logs message " HTTP3090: Failed to create logging thread " ?

    hi, i need your help. i have "sjs web6.1sp8" on hp-ux machine below message suddenly appear at load testing. [Jul/2010:03:01:52] failure ( 6477): HTTP3090: Failed to create logging thread (Insufficient resources) [Jul/2010:03:04:53] failure ( 6477):

  • Can't access ssl pages

    My friend got a PowerBook G4 from a family member.  It runs 10.4.11.  First thing off the bat: It wont connect using WPA2-Enterprise.  Browsing works, but not for any SSL pages.  (Safari and Firefox) I am told it worked just fine.  So I suspect someo

  • Is this possible? with flash+xhtml

    Hello, I have a really super-noob question, thanks in advance for helping! If I have a web site set up in xhtml/css, can I superinpose a flying flash object that travels throughout the page or would I have to rebuild the site in Flash? If it's possib