Advanced use of Swing component

Hello all,
I'm looking for websites that has interesting use of Swing to enlighten my idea on what swing is capable of.. can some of you post some interesting URLs here please? Thanks!

Here is one:
http://www2.gol.com/users/tame/swing/examples/SwingExamples.html

Similar Messages

  • How to display the contents of servlet request using the swing component.

    I am trying using the servlet to receive the request of the J2ME client. When the request will be there, this should be automatically displayed by the swing User Interface. Again, that component should display the previous requests made alongwith this request.

    Shriprasad wrote:
    I am trying using the servlet to receive the request of the J2ME client. When the request will be there, this should be automatically displayed by the swing User Interface. Again, that component should display the previous requests made alongwith this request.This makes no sense. Either there's a lot you're leaving out (maybe you're receiving requests on a server, then storing data, and you want to expose the data later via a console of some kind implemented in Swing?), or you don't understand what you're talking about.

  • 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();
         }

  • 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?

  • Swing component to use as time editor

    what is the Swing component that we can use to immitate clock component editor in windows?
    you know, the list where you can select/edit hours,minutes seconds .... is it a JList
    can somebody give a small example please
    thanks

    Read the tutorial: [How to Use Spinners|http://java.sun.com/docs/books/tutorial/uiswing/components/spinner.html]
    You will find some examples there.

  • Using the swing worker to populate the data in to jtablle

    Hello, i am developing my 1st application in java swings , i have developed it but when i run a module which fetchces the data from the mysql and display it in jtable my swing gui got blank for some initial time, i was thinking for some progress bar type thing but when i came acroos google i found that i can use swing worker to load my GUI on time and in the back ground i can do the task of fetching the data from the data base and populating the Jtable, but i had done a lot of try but not succeded to implement the swing worker . Please help me to implement the swing worker :( . i am using the abstractTableModal to populating the jtable it is working fine but swing worker is not there .
    Scenerio is like this i have base frame on which i got 1 or more btton one of those button is Clients when i click on it a Jdialog box appears with the jtable . Pleae tell me how to implement the swing worker class between this. Pleaseeeeeeeeeeeeeeeeeeeeee :( I am help less now .

    Fahim i want to display some photograph in to a swing application after fetching these photo graph from the database table , i dont know what swing component will be better for it and i m designing this in netbeans , so please assist me with that , how to go now and please note that it is dynamic so component should be like that :(. i m trying to create a photo album where i upload the multiple photograph first then i would like to show them each photograph will a text box when some one write some text in that text box and press enter i would like to save that text with that photo graph , I AM DONE WITH THE PHOTO UPLOADING TASK BUT DONT KNOW HOW TO DO THE REST LIKE DISPLAYING THE PHOTOGRAPH WITH THAT TEXT BOX .
    Edited by: kamal.java on Apr 27, 2012 8:59 AM

  • Using the swing clipboard and DefaultEditorKit.copytAction

    Hi all
    Ive heard that i can use the swing DefaultEditorKit to basically copy and paste text throughout my application (like using Ctrl+C ctrl+V)
    basically i have a number of elements such as textpanes and edit boxes and i want to be able to copy and paste text between them with the least amount of effort, most examples i have seen about implementing copy and paste require you to specify the elements that you need to copy and paste from
    i dont want to have to specify every element, i just want a simple action that says copy the selected text, and paste the selected text (dont have to worry about cut really)
    Ctrl+C and Ctrl+V both do this natrually, but how do i call a simple method that does the same thing that the keystrokes do.
    I just want two menu items that when i invoke their click listeenrs to say something like
    copylistener{
    copy();
    Ive seen a few examples of the swing methods but these also seem to need to invoke actions on the elements that you want to copy and paste between, but the keystroke dont need any of this

    Sorry, I see your confusion now.
    Yes, you need a few helper methods to get the actual Action, but you don't need to do this for every text component because the Action is shared by all text components.
    Text components use an EditorKit. The editor kit provides support for basic functionality of each text component. (ie. cursor movement, text selection, cut, copy, paste...). The EditorKit uses Actions to implement the basic support. Each Action extends TextAction which contains a method "getFocusedComponent" which returns the last text component that currently has focus. (clicking on a menu item is only a temporary loss of focus).
    So the code in the TextComponentDemo is being very efficient and is reusing the static Action that was created by the DefaultEditorKit. So even though your form may have multiple text components, you only need to create your menu item once using any text component.
    If you don't want your code to reuse the existing Actions, you can create your own Action directly from the EditorKit. Then this Action can be used to create a JMenuItem or JButton. Here is a simple example of using this approach:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=302962

  • Swing component's margin in a frame

    Hello all,
    When you set the bounds of a Swing component in a frame, it will automatically apply those bounds to the VISIBLE part of the frame, so that, a Y value of 0, for example, will not be at the very top of the frame, but right underneath the title bar of the frame. If you give a regular AWT a value of 0 to it's Y coordinate, part (or all) of it will be covered by the title bar of the frame. This does not happen with Swing components, which automatically add the height of the title bar to the value you give to their Y coordinate.
    Now, what I want to know is, how can I retrieve the value of that "automatic margin"?. How can I know the number of pixels that the Swing component is being slided down, in order to save the title bar of the frame? This value can not be constant, since it will differ from one platform to another, and from one Look 'n Feel to another, but I have not been able to find out the way to get the value that it's being applied in each case.
    As allways, many thanks in advance for your help.

    Don't know if there is any direct way to get this information. But, assuming the border width/height is equal on all four sides you could try something like:
    Dimension frameD = frame.getSize();
    Dimension contentD = frame.getContentPane().getSize();
    int borderWidth = frameD.width - contentD.width;
    int titleHeight = frameD.height - contentD.height - borderWidth;

  • Is it possible to use af:inlineframe component in JDeveloper 10.1.3.3.0 ?

    Hi,
    I need a requirement to use <af:inlineframe> component to show pdf as some portion of the entire jsf page.
    My Jdeveloper version is 10.1.3.3.0. This component is not loading when i try to include it..
    Can anyone suggest me to use this component in the current version of Jdeveloper?
    Is there any jar to include to get it (or) any patch to update to get this component..?
    Or is there any other component to achieve the above requirement with current version of jdeveloper?
    Any help is great appreciable..
    Thanks in adavance..
    Regards,
    Suresh Ketireddy

    Hi KUBA,
    Thanks for giving an idea to achieve this...
    But how can i specify the pdf to be loaded into the current page using this element...any idea?
    Thanks in advance.
    Suresh K

  • Please give me an exemple of an applet using a swing object.

    Please give me an exemple of an applet using a swing object.thank you.

    My problen is that the swing object do not appear in
    my applet. They appear only if i invoque the repaint
    methode.use JApplet, since awt components are heavyweight, and swing components are lightwieght, then your swing components get over painted with aplets background or something.
    anyhow, in your applet you may create JFrame, that would be swing component and if you set it visible, then it will be even visible.
    they say that mixing swing and awt is not good idea, especially when you don't know what you're doing (which might be true in your case)
    so try to migrate your app from AWT based stuff to SWING based stuff, or write your own AWT components that do the job whih you needed swing component for at the first place.
    but if you need to mix awt and swing, then i thing that you should not paint the fole area of applet in applets paint method -- but here i'm not sure, never mixed 'em.
    so you might try to create an applet which paint() method you leave empty and to which you add some JComponent*.
    and see what happens, maybe this JComponent will be visible.
    * -- JComponent is most likely just gray, you might want to add some subclass of it -- JButton, JTextField, JSomethingElse.

  • Support for Multilingual Numeral Input in JTextField swing component

    When the User Locale is changed from the regional & language options in the control panel and the standard digits are customized to a non Latin character set, all the windows applications adhere to the changes made. HTML also respects the changes in effect and displays any numeric values using the new character set, which are the national digits for many Eastern Locales such as Chinese, Arabic(Saudi Arabia), Urdu and many more. The JTextField swing component given by java, however, does not show any support to the new settings. Any numeric input is displayed in the Latin character set even when the input locale of the system is also changed respectively. Any text input for this case is correctly displayed in the desired literals and appropriate glyphs. However, unlike the AWT components, numeral input and display is not catered as per the user/developer's requirements. This behavior was first noticed in 2007, as far as i have found out, and was reported once again on the same thread in 2010. The thread is given below as a reference. No action or response has been taken. Kindly look into this matter and please let me know if this bug has been reported before and if there is any intent of providing a fix for it.
    Reference: http://www.coderanch.com/t/344075/GUI/java/Multilingual-support-JTextField
    Regards,
    Aitzaz Ahmad
    Software Engineer
    SENSYS

    I too had an itch to reply with something like this
    This is a sign of work well done!
    The WD has so strong UI abstraction, that hides client-server nature applications almost completely. If you search forum, you will even find posts where developers try to upgrade value of ProgressMeter in <b>for</b> loop )
    VS

  • Problems getting just the file name using an upload component

    Hi everyone, I'm using an upload component on my page and I need to get just the name of the image/file in order to store it in a database, I used the code of the tutorial and It works fine on mozilla but the problem comes when I use Internet Explorer because I get the whole path of the image/file and not just the name of it. I believe the browser is the cause of the problem, I already checked the http://jakarta.apache.org/commons/fileupload/, but I don't understand how to use anything, and not even the code of the tutorial works eventhough it is specified in comments:
    // some browsers return complete path name, some don't
       // make sure we only have the file name
       String justFileName = uploadedFileName.substring
          ( uploadedFileName.lastIndexOf(File.separatorChar) + 1 );If anybody could helpme solve this problem I'd appreciate it so much
    Regards
    Yes
    Message was edited by:
    Yesenia

    Let's walk through the code...
    File.separatorChar is the system-dependent default hame-separator charac tor. This field is initialized to contain the first character of the system property file.separator. On UNIX systems, the value of this field is '/'; on Microsoft Windows systems it is '\\'.
    String justFileName =
    // get the substring of uploadedFileName
    // that starts after the last separator (\ or /)
    uploadedFileName.substring
    uploadedFileName.lastIndexOf(File.separatorChar) + 1
    You say that this statement is returning the complete path name, for example:
    C:\Documents and Settings\All
    Users\Documentos\Mis im��genes\Im��genes de
    muestra\Puesta de sol.jpgSo, we can make an assumption that the File.separatorChar must not be \, or else the statement would return Puesta de sol.jpg.
    We know that it works for you on Solaris/Mozilla.
    We also know that Misha has tested the statement in IE and it works for him.
    (And I know that this tutorial was tested by a software engineer and a quality engineer, and it worked for both of them, as well as the tutorial author and a peer).
    So, what is different here??????
    Can you print out File.separatorChar and see if it is '\\' (I think the first \ is an escape char, that is \\ (escape-escape) is the equivalent of \ (backslash)) or '\'?
    When you run it on another machine, how are you deploying it on the other machine? Is it deployed to Solaris and running on Windows?
    Have you tested to see if it works on a Windows machine using Mozilla?
    Thanks in advance for any light you can shed on the problem.

  • Getting  the  current Mode - Basic or Advanced in the  Query Component

    Hi,
    I am using the query component for search with programmatic view objects and have modified the processQuery() method according to my requirement. I am getting required attribute names , values and operators with the help of queryEvent.getDescriptor(). But still am not able to get the cuurent mode whether it is in Basic Mode or Advance Mode. Can anyone please provide a solution to this. Thanks in advance.
    Vivek

    with the help of queryEvent.getDescriptor()queryDescriptor.getUIHints().get(QueryDescriptor.UIHINT_MODE)
    The above will return either:
    QueryDescriptor.QueryMode.BASIC or
    QueryDescriptor.QueryMode.ADVANCED
    Ref:
    http://download.oracle.com/docs/cd/E15051_01/apirefs.1111/e10684/oracle/adf/view/rich/model/QueryDescriptor.QueryMode.html
    http://download.oracle.com/docs/cd/E15051_01/apirefs.1111/e10684/oracle/adf/view/rich/model/QueryDescriptor.html

  • MYSQL error in JDeveloper 10g using ADF Swing

    I am trying to update data in mysql database. But the following error appears in JDeveloper 10g using ADF Swing
    Mysql library is mysql-connector-java-3.1.12
    What is the problem ? INSERT and SELECT queries do not give errors. But UPDATE has problem.
    Thank you in advance.
    Sony Kalkan
    (oracle.jbo.DMLException) JBO-26041: Failed to post data to database during "Update": SQL Statement "UPDATE banner Banner SET imptotal=? WHERE bid=?".
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) You have an error in your SQL syntax near 'Banner SET imptotal=22 WHERE bid=1' at line 1

    After i put a jtable,navigator on the form using appmoduledatacontrol on the top-right side of the jdeveloper, i run the form. Everything goes ok listing rows of data. But the error appears when i change the value of a field on the table and updating it using navigator.
    Thank you very much.

  • Swing component for awt.canvas

    Hi,
    Can anyone tell me the equivalent SWING component for awt CANVAS. I need it because i need to display only Images (nothing else) on it. If anyone can tell how I can do it.

    JPanel is the Swing-equivalent of java.awt.Canvas, but if you are just displaying images, you can use the JLabel class, which supports use of images as icons (see also ImageIcon class).
    Mitch Goldstein
    Author, Hardcore JFC (Cambridge Univ Press)
    [email protected]

Maybe you are looking for

  • Material no not getting displayed in ME53n

    Hello All,   Theres a problem in some PRs.It is not displaying matrial no in ME53n whereas it is dispalying in ME23n.The material description is getting displayed.It is also making the material in Item tab(material data) to be in invisible mode.Is th

  • Do you have any plans to add user polygon (boundary) creation ability to your great Excel Power Map program ?

    Hi Microsoft Excel Power Map program team! I looked @ your Excel Power Map program add on, and it's great. However everyone is looking for the ability for the user to create polygon (boundary) maps. It should not be that hard to add this functionalit

  • Having trouble with multiple lines

    I'm trying to fill out this form for an application that is a read/enter/print only PDF, and I got to a multiple line box and instead of being able to enter text in line for line, when you try to enter text it shows as one big format which I can't ch

  • Oracle 10g patch 10.0.2.1.0

    Hi We are planning to install the patch 10.0.2.1.0 to DB server. Currect status haven't install any patch on development DB. Any different after update the patch? What should I pay attention? before or after upgrade? and Should I also upgrade the ora

  • How to use itunes gift card to buy gems on Clash of Clans (in-app purchase)?

    I recently redeemed an $10 itunes gift card. The credit shows up next to my apple ID, but when I try to purchase gems on Clash of Clans I get an error that says "Insufficient Remaining Store Credit- Tap Continue to sign in". When I sign in it wants m