Blinking string in Swing

hi all ,
I don't know how to blink the string in swing...
the problem is I want to add one blinking string to JPanel when i pressed button....
if anyone knows please send me thankx

use a Timer

Similar Messages

  • Formatting a Double to a String for Swing output

    Hi, I'm new to Java and I'm working on a project with AWT & Swing. I'm trying to read in a user entered number, convert it to a double, work on it and then output the String value of the result with only two decimal places. The code I have is:
    public void actionPerformed(ActionEvent e)
    double result = 99;
    double temp;
    DecimalFormat newTemp = new DecimalFormat("#,###.00");
    if (e.getSource() == bConvert1)
    temp = (Double.parseDouble(tTemp1.getText().trim()));
    result = (temp*1.8)+32;
    newTemp.format(result);
    tResult1.setText(String.valueOf(result));
    else if (e.getSource() == bConvert2)
    temp = (Double.parseDouble(tTemp2.getText().trim()));
    result = (5.0/9)*(temp-32);
    newTemp.format(result);
    tResult2.setText(String.valueOf(result));
    This is working for some values, but for some values entered, the result displayed is just the remainder.

    The reason it doesn't always work could be because DecimalFormat (for reasons known only to Sun) uses ROUND_HALF_EVEN...
    This means that you will have to round the value to the number of decimal places you require before calling format()
    I use something like the following formatter class
    class Formatter {
      public static final int DEFAULT_PRECISION = 2;
      public static final String DEFAULT_PATTERN = "#.00";
      public static final String ZEROS = "0000000000000000";
      public static String convertDoubleToString(Double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(double d) {
        return convertDoubleToString(round(d, DEFAULT_PRECISION), DEFAULT_PATTERN);
      public static String convertDoubleToString(Double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(double d, int precision) {
        return convertDoubleToString(round(d, precision), "#." + ZEROS.substring(precision));
      public static String convertDoubleToString(Double d, String pattern) {
        return new DecimalFormat(pattern).format(d.doubleValue());
      public static String convertDoubleToString(double d, String pattern) {
        return new DecimalFormat(pattern).format(d);
      private static final double round(Double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d.doubleValue() * factor)) / factor;
      private static final double round(double d, int precision) {
        double factor = Math.pow(10, precision);
        return Math.round((d * factor)) / factor;
    }

  • How to change the Color of a string using swings/awt concept.

    Hi friends,
    How can i change the Color of a string.
    For ex:
    If i have a string "Welcome to the Java World",I want one particular Color for the string "Welcome to the" and a different Color to the "Java World" string.
    So please kindly help me out to resolve this issue.
    Thanking u in advance.

    "Text Component Features"
    http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

  • Drawing a color string with swing and Graphics2D

    hi guys,
    I am trying to draw a string on a JPanel, and can do so successfully with plain boring text using drawString(string, int, int). How can I change the font and color? Thanks!

    Read the API for java.awt.Graphics.
    db

  • Need Help to update the labels in the GUI syncronously - Swing application

    Hello everyone,
    I need some help regarding a swing application. I am not able to syncronously update the counters and labels that display on my Swing GUI as the application runs in the background. But when the running of application is completed, then the labels on the GUI are getting updated, But I want update the labels and counters on the GUI syncronously as the code executes... below I am giving the format of the code I have written..............
    public class SwingApp extends JFrame{
            // here i have declared the label and component varibles like...
                      private JTextField startTextField;
           private JComboBox maxComboBox;
           private JTextField logTextField;
           private JTextField searchTextField;
           private JLabel imagesDownloaded1;
           private JLabel imagesDownloaded2;
           private JLabel imagesDidnotDownload1;
           private JLabel imagesDidnotDownload2;
                      private JButton startButton;
    //now in the constructer.............
    public Swing(){
    //I used gridbaglayout and wrote the code for the GUI to appear....
    startButton = new JButton("Start Downloading");
        startButton.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            try{
                 actionSearch();   //actionSearch will contain all the code and the function calls of my application...........
            }catch(Exception e1){
                 System.out.println(e1);
        constraints = new GridBagConstraints();
        constraints.gridwidth = GridBagConstraints.REMAINDER;
        constraints.insets = new Insets(5, 5, 5, 5);
        layout.setConstraints(startButton, constraints);
        searchPanel.add(startButton);
    //update is a function which initiates a thread which updates the GUI. this function will be called to pass the required variables in the application
    public void update(final int count_hits, final int counter_image_download1, final int didnot_download1) throws Exception{
         Thread thread = new Thread(new Runnable() {
             public void run() {
                  System.out.println("entered into thread");
                  System.out.println("the variable that has to be set is " + count_hits);
                  server_hits_count.repaint(count_hits);
                  server_hits_count.setText( " "+ Integer.toString(count_hits));
                  imagesDownloaded2.setText(" " + Integer.toString(counter_image_download1));
                  imagesDidnotDownload2.setText(" " + Integer.toString(didnot_download1));
                  repaint();
         //this.update(count_hits);
         thread.start();
    //Now in main............................
    public static void main(String[] args){
    Swing s = new Swing();
    s.setVisible(true);
    }//end of main
    }//end of class SwingAbove I have given the skeleton code of my application........ Please tell me how to update the GUI syncronously...
    Please its a bit urgent...............
    Thank you very much in advance
    chaitanya

    First off, note that this question should have been posted in the Swing section.
    GUI events run in a separate thread (the AWT / Event Dispatch Thread) than your program.
    You should be invoking AWT/Swing events via SwingUtilities.invokeLater().
    If for whatever reason you want to have the program thread wait for the event to process
    you can use invokeAndWait().
    http://java.sun.com/javase/6/docs/api/javax/swing/SwingUtilities.html

  • Swing - components

    is there any method called "setToolTipText(string)" in swing.
    if so in which class
    and with which components it can be used

    Any class that inherets from javax.swing.JComponent gets that method.
    It's commonly used for JButtons and such but just about all swing components can use that method.

  • How to make a method sleep without affecting the responsiveness of the GUI

    Hi,
    I want to make a method sleep for a few second before executing the rest of its body. Apparently Thread.sleep(10000) doesn't do the job as it makes the GUI non-responsive.
    Any advice would be deeply appreciated.
    Thomas

    Here's an example:
    package tjacobs.ui.ex;
    import java.awt.Color;
    import javax.swing.Icon;
    import javax.swing.JLabel;
    import tjacobs.ui.util.WindowUtilities;
    * @author tjacobs
    public class Blink extends JLabel implements Runnable {
         public static final long DEFAULT_TIME_LENGTH = 1000;
         private long mTimeLength = DEFAULT_TIME_LENGTH;
         private String mLabel;
         private Icon mIcon;a
         public void run() {
              mLabel = getText();
              mIcon = getIcon();
              try {               
                   while (true) {
                        Thread.sleep(mTimeLength);
                        String current = getText();
                        if (current.equals(mLabel)) {
                             setText("");
                             setIcon(null);
                        else {
                             setText(mLabel);
                             setIcon(mIcon);
                        repaint();
              catch (InterruptedException ex) {
                   ex.printStackTrace();
              finally {
                   setText(mLabel);
                   setIcon(mIcon);
         public Blink() {
         public Blink(String arg0) {
              super(arg0);
         public Blink(Icon arg0) {
              super(arg0);
         public Blink(String arg0, int arg1) {
              super(arg0, arg1);
         public Blink(Icon arg0, int arg1) {
              super(arg0, arg1);
         public Blink(String arg0, Icon arg1, int arg2) {
              super(arg0, arg1, arg2);
         public void setBlinkTime(long time) {
              mTimeLength = time;
         public long getBlinkTime() {
              return mTimeLength;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              Blink b = new Blink("Hello World");
              b.setBackground(Color.RED);
              WindowUtilities.visualize(b);
              b.setFont(b.getFont().deriveFont(24.0f));
              b.run();
    }

  • I want to insert some checkboxes in a JList

    ...is it possible?
    I tried, but it inserts a string!
    This is my code:
    JList list = new JList();
    panel.add(list);
    CheckBox check = new JCheckBox("Yes");
    DefaultListModel model = new DefaultListModel();
    model.addElement(check);
    list.setModel(model);
    // I am able to see only the String "javax.swing.JCheckBox[,0,0,0x0, invalid,alignmentX=0.0,alignmentY=0.5,border=javax.swing.plaf.BorderUIResource$CompoundBorder.....text=User Prefix]"
    Thank you!

    Hi Sorin,
    you can aquire your data in a loop and use shift registers to store your data (use an array). To get the maximum of the array there is a function in labview "Array Max & Min".
    Hope this helps.
    Mike

  • How to create a button with an attached menu?

    I don't know how these buttons are called but I'll try to explain what I want to do. I have a toolbar where I have a button that cycles through several functions on every action - I use it to cycle through display modes. Because I do not want to switch through all other posibilties I want a menu next to it where I can directly switch to the desired display mode. Clicking on the button cycles through the modes and clicking on the attached menu provides a direct selection. What I have in mind is something like the "show images / show no images / show cached images only" Button in the Opera webbrowser, see
    http://img32.imagevenue.com/img.php?loc=loc74ℑ=a33_button_menu.jpg
    Currently I'm using a group of JToggleButtons but since I'm going to add new display modes adding new buttons would make the toolbar look too crowded.

    See if this is useful
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class SwingA implements ActionListener
    JPopupMenu pop;
    JFrame frame;
    JPanel panel;
    JButton cmdPop;
    JDialog dlgFrame;
    int times_clicked = 0;
         public static void main(String[] args)
         SwingA A=new SwingA();
         SwingA()
                    try
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                      frame=new JFrame("PopUp");
                      frame.setSize(600,480);
                      frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                      pop=new JPopupMenu();
                      cmdPop=new JButton("Click");
                     cmdPop.addActionListener(this);
                   JMenuItem item = new JMenuItem("First");
                   JMenuItem item1 = new JMenuItem("Second");
                   pop.add(item);
                   pop.add(item1);
                     panel=new JPanel();
                      panel.add(cmdPop);
                      frame.getContentPane().add(panel);
                      frame.setVisible(true);
              catch(Exception E)
         public void actionPerformed(ActionEvent source)
           pop.show(cmdPop, cmdPop.getWidth(), 0);
    }

  • Unable to uninstall Weblogic server from windows 7 64 bit machine

    I am trying to uninstall weblogic server 10.3.6 from my local windows 7 machine and i am getting a crash when I click on uninstall button or from command prompt.
    Error:
    # A fatal error has been detected by the Java Runtime Environment:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000007714ec75, pid=6384, tid=7004
    # JRE version: 7.0_01-b08
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (21.1-b02 mixed mode windows-amd64 compressed oops)
    # Problematic frame:
    # C [ntdll.dll+0x4ec75]
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    # If you would like to submit a bug report, please visit:
    # http://bugreport.sun.com/bugreport/crash.jsp
    --------------- T H R E A D ---------------
    Current thread (0x0000000007af1800): JavaThread "AWT-EventQueue-0" [_thread_in_Java, id=7004, stack(0x000000000a800000,0x000000000a900000)]
    siginfo: ExceptionCode=0xc0000005, reading address 0xffffffffffffffff
    Registers:
    RAX=0x000000000a8fd548, RBX=0x0000000000000002, RCX=0x000000000a8fd618, RDX=0x000000000a8fd588
    RSP=0x000000000a8fd538, RBP=0x000007fee8881bf0, RSI=0x0000000000000020, RDI=0x0000000000000000
    R8 =0x000000000a8f5000, R9 =0x0000000000000003, R10=0x0000000000000000, R11=0x000000000000a2d6
    R12=0x0000000000000000, R13=0x0000000000000050, R14=0x0000000000000003, R15=0x0000000007af1800
    RIP=0x000000007714ec75, EFLAGS=0x0000000000010202
    Top of Stack: (sp=0x000000000a8fd538)
    0x000000000a8fd538: 0000000000000202 0000000077107549
    0x000000000a8fd548: 000007fffff92000 0000000000000000
    0x000000000a8fd558: 0000000007af1801 000000000804ade0
    0x000000000a8fd568: 00000000593bac48 000000000b92f340
    0x000000000a8fd578: 00000000eb6c2c58 0000000000000051
    0x000000000a8fd588: 000000000a900000 000000000a8f5000
    0x000000000a8fd598: 0000000000000000 000000000a8fd750
    0x000000000a8fd5a8: 00000000029b26fa 0000000000000008
    0x000000000a8fd5b8: 000000000b902270 000000000a8fddb0
    0x000000000a8fd5c8: 00000000029d743a 00000000029d73d0
    0x000000000a8fd5d8: 0000000000000000 0000000000000000
    0x000000000a8fd5e8: 000000000a8fddb0 00000001eaf0b258
    0x000000000a8fd5f8: 000000000b9022c0 000000000a8fde20
    0x000000000a8fd608: 00000000029a6330 00000000029a5350
    0x000000000a8fd618: 0000000000000000 00000000fb03fe30
    0x000000000a8fd628: 000000000a8fde20 000000000a8fde20
    Instructions: (pc=0x000000007714ec75)
    0x000000007714ec55: d0 00 00 00 4c 89 a1 d8 00 00 00 4c 89 a9 e0 00
    0x000000007714ec65: 00 00 4c 89 b1 e8 00 00 00 4c 89 b9 f0 00 00 00
    0x000000007714ec75: 0f ae 81 00 01 00 00 0f 29 81 a0 01 00 00 0f 29
    0x000000007714ec85: 89 b0 01 00 00 0f 29 91 c0 01 00 00 0f 29 99 d0
    Register to memory mapping:
    RAX=0x000000000a8fd548 is pointing into the stack for thread: 0x0000000007af1800
    RBX=0x0000000000000002 is an unknown value
    RCX=0x000000000a8fd618 is pointing into the stack for thread: 0x0000000007af1800
    RDX=0x000000000a8fd588 is pointing into the stack for thread: 0x0000000007af1800
    RSP=0x000000000a8fd538 is pointing into the stack for thread: 0x0000000007af1800
    RBP=0x000007fee8881bf0 is an unknown value
    RSI=0x0000000000000020 is an unknown value
    RDI=0x0000000000000000 is an unknown value
    R8 =0x000000000a8f5000 is pointing into the stack for thread: 0x0000000007af1800
    R9 =0x0000000000000003 is an unknown value
    R10=0x0000000000000000 is an unknown value
    R11=0x000000000000a2d6 is an unknown value
    R12=0x0000000000000000 is an unknown value
    R13=0x0000000000000050 is an unknown value
    R14=0x0000000000000003 is an unknown value
    R15=0x0000000007af1800 is a thread
    Stack: [0x000000000a800000,0x000000000a900000], sp=0x000000000a8fd538, free space=1013k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [ntdll.dll+0x4ec75] RtlCaptureContext+0x85
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    v blob 0x00000000029d74ff
    j java.lang.String.equals(Ljava/lang/Object;)Z+8
    j javax.swing.ArrayTable.get(Ljava/lang/Object;)Ljava/lang/Object;+44
    j javax.swing.JComponent.getClientProperty(Ljava/lang/Object;)Ljava/lang/Object;+45
    j sun.swing.SwingUtilities2.stringWidth(Ljavax/swing/JComponent;Ljava/awt/FontMetrics;Ljava/lang/String;)I+23
    j javax.swing.SwingUtilities.layoutCompoundLabelImpl(Ljavax/swing/JComponent;Ljava/awt/FontMetrics;Ljava/lang/String;Ljavax/swing/Icon;IIIILjava/awt/Rectangle;Ljava/awt/Rectangle;Ljava/awt/Rectangle;I)Ljava/lang/String;+197
    j javax.swing.SwingUtilities.layoutCompoundLabel(Ljavax/swing/JComponent;Ljava/awt/FontMetrics;Ljava/lang/String;Ljavax/swing/Icon;IIIILjava/awt/Rectangle;Ljava/awt/Rectangle;Ljava/awt/Rectangle;I)Ljava/lang/String;+159
    j javax.swing.plaf.basic.BasicGraphicsUtils.getPreferredButtonSize(Ljavax/swing/AbstractButton;I)Ljava/awt/Dimension;+102
    j javax.swing.plaf.basic.BasicButtonUI.getPreferredSize(Ljavax/swing/JComponent;)Ljava/awt/Dimension;+10
    j workshop.core.plaf.JbButtonUI.getPreferredSize(Ljavax/swing/JComponent;)Ljava/awt/Dimension;+21
    j javax.swing.JComponent.getPreferredSize()Ljava/awt/Dimension;+26
    j com.bea.plateng.common.ui.gui.GUIUtilities.sameSizeButtons([Ljavax/swing/JButton;)V+42
    j com.bea.plateng.wizard.GUIContext$UpdateGUI.run()V+324
    j java.awt.event.InvocationEvent.dispatch()V+47
    j java.awt.EventQueue.dispatchEventImpl(Ljava/awt/AWTEvent;Ljava/lang/Object;)V+21
    j java.awt.EventQueue.access$000(Ljava/awt/EventQueue;Ljava/awt/AWTEvent;Ljava/lang/Object;)V+3
    j java.awt.EventQueue$3.run()Ljava/lang/Void;+12
    j java.awt.EventQueue$3.run()Ljava/lang/Object;+1
    v ~StubRoutines::call_stub
    j java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;+0
    j java.security.ProtectionDomain$1.doIntersectionPrivilege(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;Ljava/security/AccessControlContext;)Ljava/lang/Object;+28
    j java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V+46
    j java.awt.EventDispatchThread.pumpOneEventForFilters(I)Z+245
    j java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35
    j java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11
    j java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4
    j java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3
    j java.awt.EventDispatchThread.run()V+9
    v ~StubRoutines::call_stub
    --------------- P R O C E S S ---------------
    Java Threads: ( => current thread )
    0x0000000007c19800 JavaThread "D3D Screen Updater" daemon [_thread_blocked, id=5980, stack(0x000000000b050000,0x000000000b150000)]
    =>0x0000000007af1800 JavaThread "AWT-EventQueue-0" [_thread_in_Java, id=7004, stack(0x000000000a800000,0x000000000a900000)]
    0x0000000007aef800 JavaThread "Image Fetcher 0" daemon [_thread_blocked, id=412, stack(0x000000000a620000,0x000000000a720000)]
    0x0000000007a8b000 JavaThread "AWT-Windows" daemon [_thread_in_native, id=5012, stack(0x00000000084a0000,0x00000000085a0000)]
    0x0000000007a8a800 JavaThread "AWT-Shutdown" [_thread_blocked, id=6776, stack(0x00000000083a0000,0x00000000084a0000)]
    0x0000000007a89800 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=6912, stack(0x0000000008240000,0x0000000008340000)]
    0x0000000006350800 JavaThread "Service Thread" daemon [_thread_blocked, id=5756, stack(0x0000000007230000,0x0000000007330000)]
    0x000000000634f800 JavaThread "C2 CompilerThread1" daemon [_thread_blocked, id=6696, stack(0x0000000006fb0000,0x00000000070b0000)]
    0x0000000006346800 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=3956, stack(0x0000000007100000,0x0000000007200000)]
    0x0000000006346000 JavaThread "Attach Listener" daemon [_thread_blocked, id=3888, stack(0x0000000006e60000,0x0000000006f60000)]
    0x0000000006336800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=6204, stack(0x0000000006c80000,0x0000000006d80000)]
    0x0000000006254000 JavaThread "Finalizer" daemon [_thread_blocked, id=5544, stack(0x0000000006920000,0x0000000006a20000)]
    0x0000000006247000 JavaThread "Reference Handler" daemon [_thread_blocked, id=5128, stack(0x0000000006a50000,0x0000000006b50000)]
    0x00000000026db000 JavaThread "main" [_thread_in_Java, id=4076, stack(0x00000000028a0000,0x00000000029a0000)]
    Other Threads:
    0x000000000623a800 VMThread [stack: 0x00000000067e0000,0x00000000068e0000] [id=4104]
    0x0000000006363800 WatcherThread [stack: 0x0000000007420000,0x0000000007520000] [id=5560]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    Heap
    PSYoungGen total 18496K, used 9847K [0x00000000faab0000, 0x00000000fbf50000, 0x0000000100000000)
    eden space 15872K, 62% used [0x00000000faab0000,0x00000000fb44df08,0x00000000fba30000)
    from space 2624K, 0% used [0x00000000fbcc0000,0x00000000fbcc0000,0x00000000fbf50000)
    to space 2624K, 0% used [0x00000000fba30000,0x00000000fba30000,0x00000000fbcc0000)
    PSOldGen total 42240K, used 0K [0x00000000f0000000, 0x00000000f2940000, 0x00000000faab0000)
    object space 42240K, 0% used [0x00000000f0000000,0x00000000f0000000,0x00000000f2940000)
    PSPermGen total 21248K, used 11043K [0x00000000eae00000, 0x00000000ec2c0000, 0x00000000f0000000)
    object space 21248K, 51% used [0x00000000eae00000,0x00000000eb8c8c68,0x00000000ec2c0000)
    Code Cache [0x00000000029a0000, 0x0000000002c10000, 0x00000000059a0000)
    total_blobs=460 nmethods=56 adapters=356 free_code_cache=48538Kb largest_free_block=49679808
    Dynamic libraries:
    0x000000013fdf0000 - 0x000000013fe23000      C:\PROGRA~1\Java\JDK17~1.0_0\bin\javaw.exe
    0x0000000077100000 - 0x00000000772ac000      C:\Windows\SYSTEM32\ntdll.dll
    0x0000000076fe0000 - 0x00000000770ff000      C:\Windows\system32\kernel32.dll
    0x000007fefd3c0000 - 0x000007fefd42c000      C:\Windows\system32\KERNELBASE.dll
    0x000007feff0e0000 - 0x000007feff1bb000      C:\Windows\system32\ADVAPI32.dll
    0x000007fefee80000 - 0x000007fefef1f000      C:\Windows\system32\msvcrt.dll
    0x000007fefe810000 - 0x000007fefe82f000      C:\Windows\SYSTEM32\sechost.dll
    0x000007fefef20000 - 0x000007feff04e000      C:\Windows\system32\RPCRT4.dll
    0x0000000076ee0000 - 0x0000000076fda000      C:\Windows\system32\USER32.dll
    0x000007fefebe0000 - 0x000007fefec47000      C:\Windows\system32\GDI32.dll
    0x000007feff050000 - 0x000007feff05e000      C:\Windows\system32\LPK.dll
    0x000007feff1c0000 - 0x000007feff28a000      C:\Windows\system32\USP10.dll
    0x000007fefb9d0000 - 0x000007fefbbc4000      C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16661_none_fa62ad231704eab7\COMCTL32.dll
    0x000007feff060000 - 0x000007feff0d1000      C:\Windows\system32\SHLWAPI.dll
    0x000007fefcf30000 - 0x000007fefcf87000      C:\Windows\system32\apphelp.dll
    0x000007fef0500000 - 0x000007fef055a000      C:\Windows\AppPatch\AppPatch64\AcLayers.DLL
    0x000007fef7880000 - 0x000007fef78f0000      C:\Windows\system32\WINSPOOL.DRV
    0x000007fef7860000 - 0x000007fef7878000      C:\Windows\system32\MPR.dll
    0x000007fee8610000 - 0x000007fee8a77000      C:\Windows\AppPatch\AppPatch64\AcXtrnal.DLL
    0x000007feebda0000 - 0x000007feebdf1000      C:\Windows\AppPatch\AppPatch64\AcGenral.DLL
    0x000007fefcf00000 - 0x000007fefcf25000      C:\Windows\system32\SspiCli.dll
    0x000007fefe480000 - 0x000007fefe682000      C:\Windows\system32\ole32.dll
    0x000007fefd480000 - 0x000007fefe206000      C:\Windows\system32\SHELL32.dll
    0x0000000071820000 - 0x0000000071823000      C:\Windows\system32\sfc.dll
    0x000007fef8eb0000 - 0x000007fef8ec0000      C:\Windows\system32\sfc_os.DLL
    0x000007fefc390000 - 0x000007fefc3ae000      C:\Windows\system32\USERENV.dll
    0x000007fefd060000 - 0x000007fefd06f000      C:\Windows\system32\profapi.dll
    0x000007fefb3d0000 - 0x000007fefb3e8000      C:\Windows\system32\dwmapi.dll
    0x000007feff2b0000 - 0x000007feff2de000      C:\Windows\system32\IMM32.DLL
    0x000007fefe210000 - 0x000007fefe319000      C:\Windows\system32\MSCTF.dll
    0x000000006aa60000 - 0x000000006ab31000      C:\PROGRA~1\Java\JDK17~1.0_0\jre\bin\msvcr100.dll
    0x0000000059220000 - 0x00000000598ed000      C:\PROGRA~1\Java\JDK17~1.0_0\jre\bin\server\jvm.dll
    0x000007fef85b0000 - 0x000007fef85b9000      C:\Windows\system32\WSOCK32.dll
    0x000007fefee30000 - 0x000007fefee7d000      C:\Windows\system32\WS2_32.dll
    0x000007fefe970000 - 0x000007fefe978000      C:\Windows\system32\NSI.dll
    0x000007fefad30000 - 0x000007fefad6b000      C:\Windows\system32\WINMM.dll
    0x00000000772c0000 - 0x00000000772c7000      C:\Windows\system32\PSAPI.DLL
    0x00000000706e0000 - 0x00000000706ef000      C:\PROGRA~1\Java\JDK17~1.0_0\jre\bin\verify.dll
    0x000000006d100000 - 0x000000006d128000      C:\PROGRA~1\Java\JDK17~1.0_0\jre\bin\java.dll
    0x000000006fb10000 - 0x000000006fb25000      C:\PROGRA~1\Java\JDK17~1.0_0\jre\bin\zip.dll
    0x0000000060020000 - 0x00000000601b3000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\awt.dll
    0x000007fefe320000 - 0x000007fefe3f7000      C:\Windows\system32\OLEAUT32.dll
    0x000007fefcf90000 - 0x000007fefcf9f000      C:\Windows\system32\CRYPTBASE.dll
    0x000007feea6b0000 - 0x000007feea8af000      C:\Windows\system32\d3d9.dll
    0x000007fefc570000 - 0x000007fefc57c000      C:\Windows\system32\VERSION.dll
    0x000007fefbbe0000 - 0x000007fefbbe7000      C:\Windows\system32\d3d8thk.dll
    0x000007fee7a10000 - 0x000007fee8604000      C:\Windows\system32\nvd3dumx.dll
    0x000007fefbc00000 - 0x000007fefbc2c000      C:\Windows\system32\powrprof.dll
    0x000007fefec50000 - 0x000007fefee27000      C:\Windows\system32\SETUPAPI.dll
    0x000007fefd110000 - 0x000007fefd146000      C:\Windows\system32\CFGMGR32.dll
    0x000007fefd230000 - 0x000007fefd24a000      C:\Windows\system32\DEVOBJ.dll
    0x000000006f130000 - 0x000000006f164000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\fontmanager.dll
    0x000000006d0c0000 - 0x000000006d0f9000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\kcms.dll
    0x000000006ec10000 - 0x000000006ec29000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\net.dll
    0x000007fefc8d0000 - 0x000007fefc924000      C:\Windows\system32\mswsock.dll
    0x000007fefc8c0000 - 0x000007fefc8c7000      C:\Windows\System32\wship6.dll
    0x000000006aff0000 - 0x000000006b001000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\nio.dll
    0x000000006ac10000 - 0x000000006ac51000      C:\Program Files\Java\jdk1.7.0_01\jre\bin\t2k.dll
    VM Arguments:
    jvm_args: -Xmx256m -Djava.library.path=C:\Oracle\Middleware\utils\uninstall -Dhome.dir=C:\Oracle\Middleware -Dinstall.dir=
    java_command: C:\Oracle\Middleware\utils\uninstall\uninstall.jar
    Launcher Type: SUN_STANDARD
    Environment Variables:
    JAVA_HOME=C:\PROGRA~1\Java\JDK17~1.0_0
    CLASSPATH=C:\Program Files (x86)\QuickTime\QTSystem\QTJava.zip;
    PATH=C:\Oracle\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\QuickTime\QTSystem\
    OS=Windows_NT
    PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 37 Stepping 5, GenuineIntel
    --------------- S Y S T E M ---------------
    OS: Windows Vista , 64 bit Build 6000
    CPU:total 4 (2 cores per cpu, 2 threads per core) family 6 model 37 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, ht
    Memory: 4k page, physical 4052816k(1182472k free), swap 8103732k(4659796k free)
    vm_info: Java HotSpot(TM) 64-Bit Server VM (21.1-b02) for windows-amd64 JRE (1.7.0_01-b08), built on Oct 3 2011 01:39:25 by "java_re" with unknown MS VC++:1600
    time: Thu Jul 26 18:28:23 2012
    elapsed time: 0 seconds
    Two issues now
    1) How do I get rid of weblogic from my machine manually so that I can do fresh install of 10.3.5?
    2) How do I confirm if it is completely removed because after doing the complete SOA suite installation process, JDeveloper throws me errors that it is not compatible with 10.3.6
    Appreciate your help in this regard

    Hi
    I am glad your original issue is resolved. For this new SOA installation, you can post a new thread and preferably in SOA Forums and not here in WLS Forums for quicker response: SOA Suite
    1. To begin with, looks like you have a 64 bit machine, so I would recommend first to install 64 bit JDK. Then install Weblogic using weblogic generic installer (.jar). This means if you already have WLS installed using .exe, you may have to delete that and start over.
    2. Worst case even if you want to continue as it is (32 bit), the location of java is kind of not ok having a space in one of the folder names like "Program Files". And is this java installed by you or did it came with machine and if so. If came with machine it will be older version.
    I would recommend, uninstall existing JDK and install fresh latest JDK in a path something like shown below that do not have any spaces:
    1. C:\Oracle\Java\jdk1.6.0_24_64Bit = Will have JDK 64 bit
    2. C:\Oracle\Middleware116BPM = Will have WLS 10.3.6. Here you install SOA later on
    3. C:\Oracle\Middleware\Jdeveloper116 = Will have JDeveloper 11.6 installed here.
    Now, coming to your actual installation error, do NOT use this command "setup -jreLoc %JAVA_HOME%". Instead just double click on Setup.exe or open a dos window, navigate to that folder and just type setup.exe. The point is do not give -jreLoc. NOW it will prompt to enter full JDK Path. Here you carefuly type full jdk path something like this "C:\Oracle\Java\jdk1.6.0_24_32Bit" (this is on my side...). It should work now.
    Caution. While installing any oracle software do not use folder names with spaces. Like c:\Program Files\ etc. Spaces in folder names may be an issue. So avoid that.
    Since you are starting all this fresh, I would recommend doing it in the right and correct way to avoid any future issues. It may take few hours of extra time that is totally worth.
    Re: Weblogic 10.3.5 install on Windows
    Thanks
    Ravi Jegga

  • Adding JMenu directly to a JPanel

    I am trying to add a JMenu directly to a JPanel, but it isn't functioning properly. It shows up, and looks the way I expect (with an arrow, like a sub-menu), but it doesn't display its popup menu when clicked. If I add the menu to a JMenuBar, and add that to the panel, it works, but the popup drops down below the button instead of to the right, and the arrow disappears. JMenuBar appears to be adding its own actions to every menu that it contains. JMenu is a descendant of AbstractButton, so I figured it would behave like one, but no luck.
    Any help would be appreciated. By the way, I have thought of using a JButton and a JPopupMenu together, but that is not a very elegant solution. I am looking for a way to make the JMenu behave as if it were in a JMenuBar.

    Hello Vijesh
    See the code below and tell me whether it is useful ?
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class SwingA implements ActionListener
    JPopupMenu pop;
    JFrame frame;
    JPanel panel;
    JButton cmdPop;
         public static void main(String[] args)
         SwingA A=new SwingA();
         SwingA()
                   frame=new JFrame("PopUp");
                   frame.setSize(600,480);
                   frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
                   pop=new JPopupMenu();
                   cmdPop=new JButton("Click");
                   cmdPop.addActionListener(this);
    JMenuItem item = new JMenuItem("First");
    JMenuItem item1 = new JMenuItem("Second");
    pop.add(item);
    pop.add(item1);
                   panel=new JPanel();
                   panel.add(cmdPop);
                   frame.getContentPane().add(panel);
                   frame.setVisible(true);
         public void actionPerformed(ActionEvent source)
    pop.show(cmdPop, cmdPop.getWidth(), 0);
    kanad

  • SpringLayout?

    Hi
    I have just started lerning Java in my school, but they are only doing Applets and whith no LayoutManagers. But I want to learn more. My teacher isn't very good at this so I'm asking you. If you can tell me what is wrong with this code.
    The program dosen't do anything yet so thats not the problem. I'm having problem with the SpringLayout.
    Here is the code.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.Container;
    import java.awt.event.*;
    public class SpringDemo1 implements ActionListener{
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
         Container contentPane;
        public void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("Sl�ttar T�lur");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              contentPane = frame.getContentPane();
              prentaVidmot();
              //takki.addActionListener(this);
            //S�na gluggan
            frame.pack();
            frame.setVisible(true);
         public static void prentaVidmot(){
               //Set up the content pane.
              //SpringLayout layout = new SpringLayout();
              JPanel kassi = new JPanel();
              SpringLayout layout = new SpringLayout();
              kassi.setLayout(layout);
              kassi.setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
              //Create and add the components.
              JLabel label = new JLabel("Tala: ");
              JTextField tala = new JTextField(15);
              JLabel labelNidurstodur = new JLabel("Ni�urst��ur: ");
              TextArea textabox = new TextArea(5,21);
              JButton takki = new JButton("Reikna");
              kassi.add(label);
              kassi.add(tala);
              kassi.add(labelNidurstodur);
              kassi.add(textabox);
              kassi.add(takki);
              //Stilla sta�setningu label
              kassi.putConstraint(SpringLayout.WEST, label, 5,SpringLayout.WEST, kassi);
              kassi.putConstraint(SpringLayout.NORTH, label,5,SpringLayout.NORTH, kassi);
              //Stilla sta�setningu tala
              kassi.putConstraint(SpringLayout.WEST, tala,50,SpringLayout.EAST, label);
              kassi.putConstraint(SpringLayout.NORTH, tala,5,SpringLayout.NORTH, kassi);
              //Stilla sta�setningu labelNidurstodur
              kassi.putConstraint(SpringLayout.WEST, labelNidurstodur, 0, SpringLayout.WEST, label);
              kassi.putConstraint(SpringLayout.NORTH, labelNidurstodur, 10, SpringLayout.SOUTH, label);
              //Stilla sta�setningu textabox
              kassi.putConstraint(SpringLayout.WEST, textabox, 0, SpringLayout.WEST, tala);
              kassi.putConstraint(SpringLayout.NORTH, textabox, 5, SpringLayout.SOUTH, tala);
              //Stilla sta�setningu takka
              kassi.putConstraint(SpringLayout.EAST, takki,0,SpringLayout.EAST, textabox);
              kassi.putConstraint(SpringLayout.NORTH, takki,10,SpringLayout.SOUTH, textabox);
              //Stilla st�r� glugga
         public void actionPerformed(ActionEvent event){
              double teljari = (Double.parseDouble(tala.getText()));
              System.out.println("Foo");
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
    }And here is the error:
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:66: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JLabel,int,java.lang.String,javax.swing.JPanel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.WEST, label, 5,SpringLayout.WEST, kassi);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:67: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JLabel,int,java.lang.String,javax.swing.JPanel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.NORTH, label,5,SpringLayout.NORTH, kassi);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:70: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JTextField,int,java.lang.String,javax.swing.JLabel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.WEST, tala,50,SpringLayout.EAST, label);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:71: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JTextField,int,java.lang.String,javax.swing.JPanel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.NORTH, tala,5,SpringLayout.NORTH, kassi);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:74: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JLabel,int,java.lang.String,javax.swing.JLabel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.WEST, labelNidurstodur, 0, SpringLayout.WEST, label);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:75: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JLabel,int,java.lang.String,javax.swing.JLabel)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.NORTH, labelNidurstodur, 10, SpringLayout.SOUTH, label);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:78: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,java.awt.TextArea,int,java.lang.String,javax.swing.JTextField)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.WEST, textabox, 0, SpringLayout.WEST, tala);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:79: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,java.awt.TextArea,int,java.lang.String,javax.swing.JTextField)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.NORTH, textabox, 5, SpringLayout.SOUTH, tala);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:82: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JButton,int,java.lang.String,java.awt.TextArea)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.EAST, takki,0,SpringLayout.EAST, textabox);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:83: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JButton,int,java.lang.String,java.awt.TextArea)
    location: class javax.swing.JPanel
              kassi.putConstraint(SpringLayout.NORTH, takki,10,SpringLayout.SOUTH, textabox);
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:90: cannot resolve symbol
    symbol : variable tala
    location: class SpringDemo1
              double teljari = (Double.parseDouble(tala.getText()));
    ^
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:101: non-static method createAndShowGUI() cannot be referenced from a static context
    createAndShowGUI();
    ^
    12 errors
    Tool completed with exit code 1

    If you are just learning Java, you should not start with GUI programming. You'll need all the basics to really understand what you are doing.
    For example you seem to have problems reading and understanding error messages. That's understandable, because at first they may seem intimidating.
    Let's look at the first error:
    N:\T�l103\Forritun\javasafn\forrit_04_01\SpringDemo1.java:66: cannot resolve symbol
    symbol : method putConstraint (java.lang.String,javax.swing.JLabel,int,java.lang.String,javax.swing.JPanel)
    location: class javax.swing.JPanel
    kassi.putConstraint(SpringLayout.WEST, label, 5,SpringLayout.WEST, kassi);
    ^The first line tells you where the problem occurs (the file and the line nummer) and what the general error is ("cannot resolve symbol" means that some class/method/variable/... can't be found).
    The second line tells you which symbol it can't find (a method named putConstraint taking the list of parameters specified).
    The third line tells you where it tried to find the symbol (the class JPanel).
    The fourth line shows you the line of code that didn't compile.
    You should now analyze and fix each error one, one after the other.

  • Opening a HTML file through GUI

    Hi guys I am new to java and HTML and now I need to open a HTML file which is saved on disk and search for a word my code is as shown below.......
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class Test_Find extends JFrame {
        public Test_Find() {
            initComponents();
            setExtendedState(JFrame.MAXIMIZED_BOTH);
            textarea.setText(initialText);
            textarea.setCaretPosition(0);
            setVisible(true);
            textarea.requestFocusInWindow();
        private void initComponents() {
            scrollTextarea = new JScrollPane();
            textarea = new JTextArea();
            toolbar = new JToolBar();
            findB = new JButton();
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            setTitle("Test Find");
            scrollTextarea.setViewportView(textarea);
            getContentPane().add(scrollTextarea, BorderLayout.CENTER);
            toolbar.setFloatable(false);
            findB.setText("Find");
            findB.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    findBActionPerformed(evt);
            toolbar.add(findB);
            getContentPane().add(toolbar, BorderLayout.NORTH);
        private void findBActionPerformed(ActionEvent evt) {
            String input = JOptionPane.showInputDialog(
                    "Find what:", pattern);
            if(input==null){
                input="";
            pattern=input;
            doFind();
        private int doFind(){
            textarea.requestFocusInWindow();
            currentCaretPosition = textarea.getCaretPosition();
            text = textarea.getText();
            if(!pattern.equals("")){
                int pos=0;
                pos = text.toLowerCase().indexOf(pattern.toLowerCase(), currentCaretPosition);
                if(pos>-1){
                    scrollTextarea.getHorizontalScrollBar().setValue(0);
                    textarea.setCaretPosition(pos+pattern.length());
                    highlight(textarea, pattern);
                    return 1;//found
            }else{
                removeHighlights(textarea);
                return 0;//no pattern
            return -1;//not found
        // Creates highlights around all occurrences of pattern in textComp
        public void highlight(JTextComponent textComp, String pattern) {
            // First remove all old highlights
            removeHighlights(textComp);
            try {
                Highlighter hilite = textComp.getHighlighter();
                Document doc = textComp.getDocument();
                String text = doc.getText(0, doc.getLength());
                int pos = 0;
                // Search for pattern
                while ((pos = text.toLowerCase().indexOf(pattern.toLowerCase(), pos)) >= 0) {
                    // Add highlight around pattern using private painter
                    hilite.addHighlight(pos, pos+pattern.length(), textPainter);
                    pos += pattern.length();
            } catch (BadLocationException e) {
        // Removes only our private highlights
        public void removeHighlights(JTextComponent textComp) {
            Highlighter hilite = textComp.getHighlighter();
            Highlighter.Highlight[] hilites = hilite.getHighlights();
            for (int i=0; i<hilites.length; i++) {
                if (hilites.getPainter() instanceof TextPainter) {
    hilite.removeHighlight(hilites[i]);
    // An instance of the private subclass of the default highlight painter
    private Highlighter.HighlightPainter textPainter = new TextPainter(Color.yellow);
    // A private subclass of the default highlight painter
    class TextPainter extends DefaultHighlighter.DefaultHighlightPainter {
    public TextPainter(Color color) {
    super(color);
    public static void main(String args[]) {
    new Test_Find();
    private String input, pattern, text;
    private int currentCaretPosition;
    private JButton findB;
    private JScrollPane scrollTextarea;
    private JTextArea textarea;
    private JToolBar toolbar;
    private String initialText =
    "Swing JTable and JScrollPane Problem\n" +
    " tlloreti 4 Jul 5, 2005 4:15 PM\n" +
    "by Tom.Sanders \u00bb \n" +
    "Swing CTRL-A (select all) ignored in applet\n" +
    " ilmbeachgirl 4 Jul 5, 2005 4:10 PM\n" +
    "by ilmbeachgirl \u00bb \n" +
    "Swing drawing problem\n" +
    " gnosnahz 0 Jul 5, 2005 4:09 PM\n" +
    "by gnosnahz \u00bb \n" +
    "Java Event Handling events effecting panels in multiple tabs\n" +
    " sean_hagen 1 Jul 5, 2005 4:06 PM\n" +
    "by es5f2000 \u00bb \n" +
    "Swing Searching text in files & highlighting that text\n" +
    " sketty 1 Jul 5, 2005 3:57 PM\n" +
    "by camickr \u00bb \n" +
    "Swing JTextField displaying prtially its contents\n" +
    " SreeJay 1 Jul 5, 2005 3:55 PM\n" +
    "by camickr \u00bb \n" +
    "Swing how to get BufferedImage of a JPanel\n" +
    " praveen.Arora 1 Jul 5, 2005 3:53 PM\n" +
    "by camickr \u00bb \n" +
    "Swing Creating a form from a xml schema..\n" +
    " zoltern 0 Jul 5, 2005 3:51 PM\n" +
    "by zoltern \u00bb \n" +
    "Swing Da Suckers: Java and Windows XP\n" +
    " [email protected] 1 Jul 5, 2005 3:42 PM\n" +
    "by [email protected] \u00bb \n" +
    "Java 2D Rescaling using JAI\n" +
    " G-Rehuku 0 Jul 5, 2005 3:30 PM\n" +
    "by G-Rehuku \u00bb \n" +
    "Swing how to get Page Preview of multiple page JPanel\n" +
    " Sonu.Arora 0 Jul 5, 2005 2:20 PM\n" +
    "by Sonu.Arora \u00bb \n" +
    "Swing IDE for Swing Development\n" +
    " JavaEnthusiastt 8 Jul 5, 2005 2:17 PM\n" +
    "by uhrand \u00bb \n" +
    "Java 2D Can't connect to X11 window server\n" +
    " kusigubi 0 Jul 5, 2005 2:06 PM\n" +
    "by kusigubi \u00bb \n";
    }Since I am new to the field requesting the kind quick help by java experts here to help me change the code so that I would be able to search a web apge saved on disk and search and highlight a word in that page ....
    Thanks in advance........
    Looking forward for your kind suggestions.......                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Since I am new to the field requesting the kind quick help by java experts here to help me change the code so that I would be able to search a web apge saved on disk and search and highlight a word in that page ....
    Thanks in advance........
    Looking forward for your kind suggestions......1) Did you write that code? If yes, proceed to 2). If no, I charge 150 euros/hr. Let me know when you want me to start.
    2) Post the code for a program that opens a text file with the following in it:
    hello world
    and prints the contents out using System.out.println().
    3) Modify the program in 2) to determine if the file contains the word "yes". Post the code.
    4) An html file is no different than the text file in 2).

  • TreeCellRendere updating icons

    I have a TreeCellRederer which changes the icons of JTREE when openen/closing items (linked to start/stop applications)
    When an item (application) is open and i switch to another item, the icon does not change (correct because app is still running). When i select an item and close the application, the icon is changed correctly (from closed to open and vise versa).
    When an item (app3) is open and i switch to another application (app2) and then close the app2, my cursus jumps to item 0 (top level) and the icon of the app2 is closed. Then i close app3 (without selecting it first). Now it is goes wrong, the icon is not changed. This is because the line is not rendered.
    I can force closing of the item by jumping to the last item in the list and then to the first item in the list "removeFromActiveApplicationList(String application)" method, but this is a bit of overkill.
    The problem is that the item-row is not rendered when application is closed without the item be-ing active. Any idea how to solve this?
    I will include all coding but icon-iconimages.
    MenuApplication:
    package myMenu;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Toolkit;
    import java.beans.PropertyChangeEvent;
    import java.beans.PropertyChangeListener;
    import java.beans.PropertyVetoException;
    import java.net.URL;
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.StringTokenizer;
    import java.util.logging.Handler;
    import java.util.logging.Logger;
    import javax.swing.ImageIcon;
    import javax.swing.JDesktopPane;
    import javax.swing.JFrame;
    import javax.swing.JInternalFrame;
    import javax.swing.JPanel;
    import javax.swing.JSplitPane;
    import javax.swing.JTree;
    import javax.swing.event.TreeSelectionEvent;
    import javax.swing.event.TreeSelectionListener;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import testje.testApp;
    import testje.testInternalFrame;
    public class MenuTest extends JFrame implements TreeSelectionListener{
        // System Properties
        public static Logger myLogger = Logger.getLogger(MenuTest.class.getName());
        public Handler myHandler = null;
        private static String appName;
        // Variables
        public ArrayList activeApplicationList;
        private Object[] [] data;
        private ArrayList sflData;
        public String selectedApplication;
        // Swing objects and varialbles
        public JDesktopPane myDeskTop;
        private JPanel jContentPane = null;
        private JSplitPane jSplitPane = null;
        private JTree jTree = null;
        private javax.swing.JMenuBar jJMenuBar = null;
        private javax.swing.JMenu fileMenu = null;
        private javax.swing.JMenuItem exitMenuItem = null;
        private boolean packFrame = false;
        private PropertyChangeEvent currentEvent;
        // Applications
        private testApp myPanelTestje;
        private testInternalFrame myFrameTestje;
         * This is the default constructor
        public MenuTest() {
            super();
            initialize();
            setAppName("Test Menu");
         * Launches this application
        public static void main(String[] args) {
             MenuTest myMenu = new MenuTest();
             myMenu.setVisible(true);
         * This method initializes this
         * @return void
        private void initialize() {
            setContentPane(getJContentPane());
            setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
            setJMenuBar(getJJMenuBar());
            setSize(800, 600);
            setTitle("MyMenu");
            setVisible(true);
            //Validate frames that have preset sizes
            //Pack frames that have useful preferred size info, e.g. from their layout
            if (packFrame) {
              this.pack();
            else {
              this.validate();
            //Center the window
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            Dimension frameSize = this.getSize();
            if (frameSize.height > screenSize.height) {
              frameSize.height = screenSize.height;
            if (frameSize.width > screenSize.width) {
              frameSize.width = screenSize.width;
            setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
         * This method initializes jJMenuBar   
         * @return javax.swing.JMenuBar
        private javax.swing.JMenuBar getJJMenuBar() {
            if (jJMenuBar == null) {
                jJMenuBar = new javax.swing.JMenuBar();
                jJMenuBar.add(getFileMenu());
            return jJMenuBar;
         * This method initializes jMenu   
         * @return javax.swing.JMenu   
        private javax.swing.JMenu getFileMenu() {
            if (fileMenu == null) {
                fileMenu = new javax.swing.JMenu();
                fileMenu.setText("File");
                fileMenu.add(getExitMenuItem());
            return fileMenu;
         * This method initializes jMenuItem   
         * @return javax.swing.JMenuItem   
        private javax.swing.JMenuItem getExitMenuItem() {
            if (exitMenuItem == null) {
                exitMenuItem = new javax.swing.JMenuItem();
                exitMenuItem.setText("Exit");
                exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
                    public void actionPerformed(java.awt.event.ActionEvent e) {   
                        System.exit(0);
            return exitMenuItem;
         * This method initializes jContentPane
         * @return javax.swing.JPanel  
        private JPanel getJContentPane() {
            if (jContentPane == null) {
                jContentPane = new JPanel();
                jContentPane.setLayout(new BorderLayout());
                jContentPane.add(getJSplitPane(), java.awt.BorderLayout.CENTER);
            return jContentPane;
         * This method initializes jSplitPane  
         * @return javax.swing.JSplitPane  
        private JSplitPane getJSplitPane() {
            if (jSplitPane == null) {
                jSplitPane = new JSplitPane();
                jSplitPane.setLeftComponent(getJTree());
                myDeskTop = new JDesktopPane();
                jSplitPane.setRightComponent(myDeskTop);
                jSplitPane.setDividerLocation(150);
            return jSplitPane;
        private JTree getJTree() {
            if (jTree == null) {
                // Create Root
                DefaultMutableTreeNode root = new DefaultMutableTreeNode("Conti7");
                setActiveApplicationList(new ArrayList());
                // Create ApplicationsList
                // Get Applicationlist
                getApplicationList();
                // Process MenuArray to create Menu
                String previousFolder = "";
                DefaultMutableTreeNode newNode = new DefaultMutableTreeNode();
                for (int i = 0; i < sflData.size(); i++){
                    myLogger.fine(
                            "Dataline "+i +" =" + data[0] + " | "
    + data[i][1] + " | "
    + data[i][2] + " | "
    + data[i][3] + " | "
    + data[i][4] + " | "
    + data[i][5]);
    if (!(((String)data[i][2]).equals(previousFolder))) {
    if (!(previousFolder.equals(""))){
    root.add(newNode);
    previousFolder = (String)data[i][2];
    newNode = new DefaultMutableTreeNode(previousFolder);
    newNode.add(new DefaultMutableTreeNode(data[i][3]));
    if (!previousFolder.equals("")){
    root.add(newNode);
    // Add Full menu to tree
    jTree = new JTree(root);
    jTree.setCellRenderer(new TreeExRenderer());
    jTree.addTreeSelectionListener(this);
    return jTree;
    public void valueChanged(TreeSelectionEvent event) {
    String selectedApplication = jTree.getLastSelectedPathComponent().toString();
    myLogger.info(
    "Current Item Selection = " + selectedApplication);
    setSelectedApplication(selectedApplication);
    activateApplication(selectedApplication);
    private void activateApplication(String selectedApplication) {
    if (getSelectedApplication().equals("PanelTestje")){
    if (myPanelTestje==null){
    myPanelTestje = new testje.testApp();
    addInternalFrame(myPanelTestje);
    activateInternalFrame(myPanelTestje);
    if (getSelectedApplication().equals("FrameTestje")){
    if (myFrameTestje==null){
    myFrameTestje = new testje.testInternalFrame();
    addInternalFrame(myFrameTestje);
    activateInternalFrame(myFrameTestje);
    public void addInternalFrame(JInternalFrame myFrame) {
    myDeskTop.add(myFrame);
    myFrame.pack();
    myFrame.setClosable(true);
    try {
    myFrame.setMaximum(true);
    } catch (PropertyVetoException e){}
    myFrame.addPropertyChangeListener(new PropertyChangeHandler());
    activeApplicationList.add(getSelectedApplication());
    Collections.sort(activeApplicationList);
    public void activateInternalFrame(JInternalFrame myFrame) {
    myFrame.setVisible(true);
    myFrame.toFront();
    class PropertyChangeHandler implements PropertyChangeListener {
    public void propertyChange(PropertyChangeEvent e) {
    if (((String)e.getPropertyName()).equals("closed")){
    setCurrentEvent(e);
    deActivateApplication(e);
    private void deActivateApplication(PropertyChangeEvent currentEvent){
    if ((getCurrentEvent().getSource() instanceof testje.testApp)){
    myPanelTestje = null;
    removeFromActiveApplicationList("PanelTestje");
    if ((getCurrentEvent().getSource() instanceof testje.testInternalFrame)){
    myFrameTestje = null;
    removeFromActiveApplicationList("FrameTestje");
    * Deze methode wordt gebruikt om de applicatienaam op
    * te vragen.
    * <p>
    * @return appName : appName Objectvalue.
    public static String getAppName() {
    return appName;
    * Deze methode wordt gebruikt om de applicatie af te sluiten
    * nadat eerst connectieObject wordt afgesloten.
    * <p>
    public static void exitApplication() {
    myLogger.info("End application.");
    System.exit(0);
    private static void setAppName(String appName)
    MenuTest.appName = appName;
    public class TreeExRenderer extends DefaultTreeCellRenderer {
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
    super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf,
    row, hasFocus);
    String nodeName = value.toString();
    ImageIcon main_leaf = createImageIcon("/images/jTreeRoot.gif");
    ImageIcon main_open = createImageIcon("/images/jTreeRoot.gif");
    ImageIcon main_close = createImageIcon("/images/jTreeRoot.gif");
    ImageIcon leafIcon = createImageIcon("/images/jTreeFolderClosed.gif");
    ImageIcon leafOpen = createImageIcon("/images/jTreeFolderOpen.gif");
    ImageIcon leafClosed = createImageIcon("/images/jTreeFolderClosed.gif");
    ImageIcon leafSelected = createImageIcon("/images/jTreeItemSelected.gif");
    ImageIcon leafActivated = createImageIcon("/images/jTreeItemSelected.gif");
    if (row==0){
    setIcon(main_leaf);
    } else {
    if(sel){
    setIcon(leafSelected);
    } else {
    if (!expanded) {
    if (isApplicationInActiveList(nodeName)){
    setIcon(leafActivated);
    } else {
    setIcon(leafClosed);
    }else{
    setIcon(leafOpen);
    return this;
    public ImageIcon createImageIcon(String path) {
    URL imgURL = MenuTest.class.getResource(path);
    URL imgURL1 = MenuTest.class.getResource(path);
    if ((imgURL != null)) {
    return new ImageIcon(imgURL);
    } else if ((imgURL == null)) {
    return new ImageIcon(imgURL1);
    } else {
    System.out.println("Hello ");
    System.err.println("Couldn't find file: " + path);
    return null;
    private ArrayList getActiveApplicationList()
    return activeApplicationList;
    private void setActiveApplicationList(ArrayList activeApplicationList)
    this.activeApplicationList = activeApplicationList;
    private boolean isApplicationInActiveList(String nodeName)
    if (activeApplicationList.indexOf(nodeName)>-1) {
    return true;
    } else {
    return false;
    public void removeFromActiveApplicationList(String application)
    activeApplicationList.remove(activeApplicationList.indexOf(application));
    // jTree.setSelectionRow((jTree.getRowCount())-1);
    jTree.setSelectionRow(0);
    public String getSelectedApplication()
    return selectedApplication;
    private void setSelectedApplication(String selectedApplication)
    this.selectedApplication = selectedApplication;
    public PropertyChangeEvent getCurrentEvent()
    return currentEvent;
    private void setCurrentEvent(PropertyChangeEvent currentEvent)
    this.currentEvent = currentEvent;
    private void getApplicationList() {
    sflData = new ArrayList();
    // Get Applicationlist
    sflData.add("PGO;50;General;App1;pack.myApp1;Application 1");
    sflData.add("PGO;55;Operational;App2;pack.myApp2;Application 2");
    sflData.add("PGO;60;Operational;App3;pack.myApp3;Application 3");
    sflData.add("PGO;65;Expeditie;PanelTestje;testje.Paneltestje;Expeditie Paneltestje");
    sflData.add("PGO;70;Desktop;App4;pack.myApp4;Application 4");
    sflData.add("PGO;75;Manifest;FrameTestje;testje.FrameTestje;Maritiem FrameTestje");
    sflData.add("PGO;80;Desktop;App5;pack.myApp5;Application 5");
    // Convert applicationlist to MenuArray
    data = new Object[sflData.size()][6];
    for (int i = 0; i < sflData.size(); i++){
    int count = 0;
    String str;
    str = (String)sflData.get(i);
    StringTokenizer token = new StringTokenizer(str,";");
    while (token.hasMoreTokens()){
    data [i] [count] = token.nextToken();
    count++;
    *testapp1*package testje;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    * @author pgo
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class testApp
    extends JInternalFrame {
         testPanel p;
    Container c;
    boolean packFrame = false;
         public testApp() {
              super("Swing-Toepassing PanelTestje");
              c = getContentPane();
    c.setLayout(new BorderLayout());
              p = new testPanel();
              c.add(p);
    //setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setVisible(true);
    //Validate frames that have preset sizes
    //Pack frames that have useful preferred size info, e.g. from their layout
    if (packFrame) {
    this.pack();
    else {
    this.validate();
    // addWindowListener(new WindowAdapter() {
    // public void windowClosed(WindowEvent e) {
    // System.exit(0);
         public static void main(String[] args) {
              // final JFrame f = new testApp();
    // new testApp();
    *testInternalFrame*/*
    * Created on 19-apr-2007
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package testje;
    import javax.swing.*;
    import java.awt.*;
    * @author pgo
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class testInternalFrame extends JInternalFrame {
         public void testInternalFrame(){
              setBackground(Color.white);
              Container contentPane = getContentPane();
              setLocation(20,20);
              setTitle("Internal Frame");
              setClosable(true);
              setResizable(true);
              setMaximizable(true);
              setIconifiable(true);
              setVisible(true);
              contentPane.setLayout(new FlowLayout());
              contentPane.add(new JTextArea(5,15), "Center");
              pack();
    *testPanel*/*
    * Created on 19-apr-2007
    * TODO To change the template for this generated file go to
    * Window - Preferences - Java - Code Style - Code Templates
    package testje;
    import javax.swing.*;
    import java.awt.*;
    * @author pgo
    * TODO To change the template for this generated type comment go to
    * Window - Preferences - Java - Code Style - Code Templates
    public class testPanel extends JPanel {
         public void testPanel(){
              setBackground(Color.blue);
         public void paintComponent (Graphics g){
              super.paintComponent(g);
              g.drawString("Groeten van Patrick", 0, 60);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            

    When you say "the JLabel changes" I'm guessing you mean that the JLabel variable named "imageLabel" was the thing that changed? That won't change the GUI's reference to the original JLabel object.
    Which is what you have to change. You have a reference to that object in the form of the "imageLabel" variable; to change the object you call one of its methods, like maybe setIcon() or something... whatever your ImageManager class is doing to create the label in the first place.

  • My JList does not scroll

    hello forum,
    my JList (indentifier=PKGList) does not scroll. Can any look at code and tell me what's the problem. Following is the code. To test this code create two files in same directory. No package statement is there in code.
    1. javaEditor.java
    2. key_words.java
    copy the respective codes. compile these files.
    run command >> java javaEditor .
    Then my GUI will appear. click "new file" from file menu.
    then type "import". press SPACE BAR. a list box will appear conatining list of some packages.
    This is where the problem is [b]. this list box does not sroll.
    at some places,for the ease of identification, i have put the comments..
    ///PAY ATTENTION HERE BEGINS
    and
    ///PAY ATTENTION HERE ENDS .
    I will be thankfull whoever helps me.
    /* javaEditor.java  */
    import javax.swing.*;
    import javax.swing.text.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import java.lang.reflect.*;
    public class javaEditor extends JFrame
         JMenuBar menubar;
         JMenu menu;
         JMenuItem menuitem;
         Container pane;
         Package PKGname;     
         JList PKGlist;
         Vector files;
         Vector PACKAGE;
         static Vector ClassList;
         JTextArea JTA;
         char flag;
         javaEditor()
              super("JavaEditor");
              PACKAGE=new Vector();
              files= new Vector();          
              ClassList=new Vector();
              flag='0';
              pane=getContentPane();          
              pane.setLayout(null);
              window_listener WL=new window_listener(this);
              addWindowListener(WL);
              action_listener AL=new action_listener(this);
              PKGlist=new JList();
              Package pkg[]=Package.getPackages();
              for (int i=0;i<pkg.length;i++)
                   PACKAGE.add(i,pkg.getName());               
              }//for
    [I]
    ///PAY ATTENTION HERE BEGINS
              PKGlist.setListData(PACKAGE);          
              JScrollPane scrollPane = new JScrollPane(PKGlist);
              PKGlist.setAutoscrolls(true);
              pane.add(PKGlist);
    ///PAY ATTENTION HERE ENDS
              ////////////File menu//
              menubar=new JMenuBar();          
              setJMenuBar(menubar);
              menu=new JMenu("File");     
                   menuitem=new JMenuItem("New File");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
                   menuitem=new JMenuItem("Open");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
                   menuitem=new JMenuItem("Save As...");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
              menubar.add(menu);
              menu=new JMenu("Edit");
                   menuitem=new JMenuItem("Cut");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
                   menuitem=new JMenuItem("Copy");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
                   menuitem=new JMenuItem("Paste");
                   menuitem.addActionListener(AL);
                   menu.add(menuitem);
              menubar.add(menu);          
              setJMenuBar(menubar);          
              setDefaultCloseOperation(EXIT_ON_CLOSE);
         }//javaEditor()
         public static void main(String s[])
              javaEditor JE =new javaEditor();
              JE.setSize(500,500);
              JE.setVisible(true);
         }//public static void main(String s[])
         public boolean isClass(String str)
              int i=0;
              System.out.println("searching"+str+" ................");
              while(i<javaEditor.ClassList.size())
                   Class c=(Class)javaEditor.ClassList.elementAt(i);
                   String str1=c.getName();
                   str1=str1.substring(str1.lastIndexOf('.')+1);
                   System.out.println("\t\tMaching with "+str1);
                   if(str1.equals(str))
                        System.out.println("....mached");
                        return true;                    
                   i++;
              return false;
         public Class  findClass(String str)
              int i=0;
              while(i<javaEditor.ClassList.size())
                   Class c=(Class)javaEditor.ClassList.elementAt(i);
                   String str1=c.getName();
                   str1=str1.substring(str1.lastIndexOf('.')+1);
                   if(str1.equals(str))
                        return c;
                   i++;
              return null;
    }//javaEditor extends JFrame
    class action_listener implements ActionListener
         javaEditor JE;
         action_listener (javaEditor JE1)
              JE=JE1;
         public void actionPerformed(ActionEvent e)
              if (e.getActionCommand()=="New File")//adds JTEXT AREA
                   FileOpener file_opener=new FileOpener(JE);
                   file_opener.openNewFile();
                   JE.files.add(FileOpener.counter,file_opener);
              if (e.getActionCommand()=="Open")
                   try
                        JFileChooser chooser = new JFileChooser();               
                        int returnVal = chooser.showOpenDialog(JE);
                        if(returnVal == JFileChooser.APPROVE_OPTION)
                            System.out.println("You chosed to open this file: "+
                             chooser.getSelectedFile().getName());                    
                             FileOpener file_opener=new FileOpener(JE);
                             file_opener.openFile(chooser.getSelectedFile());
                             JE.files.add(FileOpener.counter,file_opener);
                        }//if(returnVal == JFileChooser.APPROVE_OPTION)
                   }//try
                   catch(Exception excptn)
                        System.out.println(excptn);
                   }//catch(Exception excptn)
              if (e.getActionCommand()=="Save As...")
                   try
                        JFileChooser chooser = new JFileChooser();               
                        int returnVal = chooser.showSaveDialog(JE);
                        if(returnVal == JFileChooser.APPROVE_OPTION)
                           System.out.println("You chose to save this file: " +
                                  chooser.getSelectedFile().getName());
                           FileOutputStream fileOS=new FileOutputStream(chooser.getSelectedFile());
                          //String tofile=JTA.getText();
                          //fileOS
                        }//if(returnVal == JFileChooser.APPROVE_OPTION)
                   catch(Exception ex)
              }//if (e.getActionCommand()=="Save As...")          
         }//actionPerformed(ActionEvent e)
    }//action_listener implements ActionListener
    class window_listener extends WindowAdapter
         javaEditor JE;
         window_listener(javaEditor JE1)
              JE=JE1;
    }//window_listener extends WindowAdapter
    class key_listener implements KeyListener
              JTextArea JTA;
              javaEditor JE;
              StringTokenizer str_tok;
              key_listener (JTextArea JTA1,javaEditor JE1)
                   JTA=JTA1;
                   JE=JE1;
          public void keyPressed(KeyEvent e)
               if (e.getSource()==JTA)
                        Character c = new Character(e.getKeyChar());
                        String str= JTA.getText()+c.toString();
                        String str1="hsdk";
                        if(JTA.getCaretPosition()!=0)
                        str=str.substring(0,JTA.getCaretPosition()+1);
                        str_tok=new StringTokenizer(str," \n\r\t;:{}%\\+-*&!.");
                        while(str_tok.hasMoreTokens())
                             str1=str_tok.nextToken();
                        //while(str_tok.hasMoreTokens())
                        if(key_words.isKeyWord(str1))
                             System.out.println("key word "+str1);
                             if(str1.equals("import"))
                                  JE.flag='p';                                             
                             else
                                  JE.flag='k';                                             
                        }//if(key_words.isKeyWord(str1))
                        else if(JE.isClass(str1))
                             System.out.println("class is in list");
                        else if(c.equals(new Character(' '))||c.equals(new Character('.')))
                             Class CLASS;
                             ClassSearch.ifClassAddToList(str1);                                
                             if(JE.isClass(str1))
                                  Method methods[];
                                  System.out.println("searching "+str1+" class into list");
                                  CLASS=JE.findClass(str1);
                                  System.out.println("after finding "+CLASS.getName());
                                  methods=CLASS.getDeclaredMethods();
                                  for(int i=0;i<methods.length;i++)
                                       System.out.println(methods.toString());
                             System.out.println("proceeding............");
                             //CS.start();                    
                        if(JE.flag=='p' && c.equals(new Character(' ')))
                             Caret crt=JTA.getCaret();
                             Point p=crt.getMagicCaretPosition();
    [I]
    ///PAY ATTENTION HERE BEGINS
                             JE.PKGlist.setVisible(true);
                             JE.PKGlist.grabFocus();
                             JE.PKGlist.setOpaque(true);
                             JE.PKGlist.setBackground(new Color(150,150,150));                         
                             JE.PKGlist.setBounds(p.x+JTA.getX()+10,p.y+JTA.getY()+60,50,100);
    ///PAY ATTENTION HERE ENDS
                        }//if(JE.flag=='p' && c.equals(new Character(' ')))
                        if(JE.flag=='C' && c.equals(new Character(' ')))
                        JTA.repaint();
                        JE.pane.repaint();
               }///if e.getSource()
               if (e.getSource()==JE.PKGlist)
                    if(e.getKeyCode()==e.VK_ENTER||e.getKeyCode()==e.VK_SPACE||e.getKeyCode()==e.VK_TAB)
                              JE.PKGlist.setVisible(false);
                              String selectedstr=(String)JE.PKGlist.getSelectedValue();
                              System.out.println(selectedstr);
                              String toAdd=" "+selectedstr+".*;";
                              JTA.insert(toAdd,JTA.getCaretPosition());
                              JTA.grabFocus();
                              JE.flag='0';
                    }//if(e.getKeyCode()==e.VK_ENTER.....
               }//if (e.getSource()==JE.PKGlist)
          public void keyReleased(KeyEvent e){}//keyReleased ends
          public void keyTyped(KeyEvent e){}//keyTyped ends
    class FileOpener
         javaEditor JE;
         static int counter=-1;
         String name;
         JTextArea JTA;
         JInternalFrame  JIF;
         boolean isSaved;
         FileOpener(javaEditor JE1)
              JE=JE1;
              counter++;
              name=new String("NoName-"+Integer.toString(counter)+".java");
              JTA=new JTextArea();          
              isSaved=false;
         }//FileOpener(javaEditor JE1)
         public void openNewFile()
                   JIF=new JInternalFrame(name,true, true, true, true) ;
                   JIF.setBounds(0,10,JE.getWidth(),JE.getHeight()-50);               
                   JTA.setBounds(0,20,JE.getWidth(),JE.getHeight()-50);               
                   key_listener KL=new key_listener(JTA,JE);
                   JTA.addKeyListener(KL);
                   JE.PKGlist.addKeyListener(KL);
                   JIF.getContentPane().add(JTA);               
                   JIF.setVisible(true);
                   JE.pane.add(JIF);
                   JE.repaint();
                   JIF.grabFocus();     
                   JIF.moveToFront();
                   JTA.grabFocus();
         }//openNewFile()
         public void openFile(File file) throws FileNotFoundException,IOException
                   JIF=new JInternalFrame(file.getName(),true, true, true, true) ;
                   JIF.setBounds(0,10,JE.getWidth(),JE.getHeight()-50);               
                   JTA.setBounds(0,20,JE.getWidth(),JE.getHeight()-50);               
                   FileInputStream fileInputStream=new FileInputStream(file);
                   byte buf[]=new byte[fileInputStream.available()];
                   fileInputStream.read(buf);
                   JTA.setText(new String(buf));
                   key_listener KL=new key_listener(JTA,JE);
                   JTA.addKeyListener(KL);
                   JE.PKGlist.addKeyListener(KL);
                   /************************************************************/          JIF.getContentPane().add(JTA);
                   JIF.setVisible(true);
                   JE.pane.add(JIF);
                   JE.repaint();
                   JIF.grabFocus();     
                   JIF.moveToFront();
                   JTA.grabFocus();
         }//openFile(File file)
    }//class FileOpener
    class ClassSearch //extends Thread
         public static  void ifClassAddToList(String str)
              String pkg[]=  new String[77];
              pkg[0]=new String("java.applet.");
              pkg[1]=new String("java.awt.");
              pkg[2]=new String("java.awt.color.");
              pkg[3]=new String("java.awt.datatransfer.");
              pkg[4]=new String("java.awt.dnd.");
              pkg[5]=new String("java.awt.event.");
              pkg[6]=new String("java.awt.font.");
              pkg[7]=new String("java.awt.geom.");
              pkg[8]=new String("java.awt.im.");
              pkg[9]=new String("java.awt.im.spi");
              pkg[10]=new String("java.awt.image.");
              pkg[11]=new String("java.awt.image.renderable");
              pkg[12]=new String("java.awt.print.");
              pkg[13]=new String("java.beans.");
              pkg[14]=new String("java.beans.beancontext.");
              pkg[15]=new String("java.io.");
              pkg[16]=new String("java.lang.");
              pkg[17]=new String("java.lang.ref.");
              pkg[18]=new String("java.lang.reflect.");
              pkg[19]=new String("java.math.");
              pkg[20]=new String("java.net.");
              pkg[21]=new String("java.rmi.");
              pkg[22]=new String("java.rmi.activation.");
              pkg[23]=new String("java.rmi.dgc.");
              pkg[24]=new String("java.rmi.registry.");
              pkg[25]=new String("java.rmi.server.");
              pkg[26]=new String("java.security.");
              pkg[27]=new String("java.security.acl.");
              pkg[28]=new String("java.security.cert.");
              pkg[29]=new String("java.security.interfaces.");
              pkg[30]=new String("java.security.spec.");
              pkg[31]=new String("java.sql.");
              pkg[32]=new String("java.text.");
              pkg[33]=new String("java.util.");
              pkg[34]=new String("java.util.jar.");
              pkg[35]=new String("java.util.zip.");
              pkg[36]=new String("javax.accessibility.");
              pkg[37]=new String("javax.media.sound.midi.");
              pkg[38]=new String("javax.media.sound.midi.spi.");
              pkg[39]=new String("javax.media.sound.sampled.");
              pkg[40]=new String("javax.media.sound.sampled.spi.");
              pkg[41]=new String("javax.naming.");
              pkg[42]=new String("javax.naming.directory.");
              pkg[43]=new String("javax.naming.event.");
              pkg[44]=new String("javax.naming.ldap.");
              pkg[45]=new String("javax.naming.spi.");
              pkg[46]=new String("javax.rmi.");
              pkg[47]=new String("javax.rmi.CORBA.");
              pkg[48]=new String("javax.swing.");
              pkg[49]=new String("javax.swing.border.");
              pkg[50]=new String("javax.swing.colorchooser.");
              pkg[51]=new String("javax.swing.event.");
              pkg[52]=new String("javax.swing.filechooser.");
              pkg[53]=new String("javax.swing.plaf.");
              pkg[54]=new String("javax.swing.plaf.basic.");
              pkg[55]=new String("javax.swing.plaf.metal.");
              pkg[56]=new String("javax.swing.plaf.multi.");
              pkg[57]=new String("javax.swing.table." );
              pkg[58]=new String("javax.swing.text.");
              pkg[59]=new String("javax.swing.text.html.");
              pkg[60]=new String("javax.swing.text.html.parser.");
              pkg[61]=new String("javax.swing.text.rtf.");
              pkg[62]=new String("javax.swing.tree.");
              pkg[63]=new String("javax.swing.undo." );
              pkg[64]=new String("javax.transaction." );
              pkg[65]=new String("org.omg.CORBA." );
              pkg[66]=new String("org.omg.CORBA_2_3." );
              pkg[67]=new String("org.omg.CORBA_2_3.portable." );
              pkg[68]=new String("org.omg.CORBA.DynAnyPackage." );
              pkg[69]=new String("org.omg.CORBA.ORBPackage." );
              pkg[70]=new String("org.omg.CORBA.portable." );
              pkg[71]=new String("org.omg.CORBA.TSIdentificationPackage." );
              pkg[72]=new String("org.omg.CORBA.TypeCodePackage." );
              pkg[73]=new String("org.omg.CORBA.ValueDefPackage." );
              pkg[74]=new String("org.omg.CosNaming." );
              pkg[75]=new String("org.omg.CosNaming.NamingContextPackage." );
              pkg[76]=new String("org.omg.SendingContext." );
              boolean found=false;
              int counter=0;
              Class cl;
              String str1=str;
              while(counter<77&&found==false)
                   try
                        System.out.println("searching for "+str1);                    
                        cl=Class.forName(str1);                    
                        found=true;                    
                        if(javaEditor.ClassList.isEmpty())
                             javaEditor.ClassList.add(0,cl);                    
                             Class c=(Class)javaEditor.ClassList.elementAt(0);
                             System.out.println(c.getName());
                        else
                             javaEditor.ClassList.add(javaEditor.ClassList.size(),cl);
                   catch(Exception e)
                        str1=pkg[counter]+str;
                   counter++;
              return ;
    /*############# key_words.java*/
    public class key_words
         public static boolean isKeyWord(String keyword)
              String list[]= new String[48];
              list[0] = "abstract";
              list[1] = "boolean";
              list[2] = "break";
              list[3] = "byte";
              list[4] = "case";
              list[5] = "catch";
              list[6] = "char";
              list[7] = "class";
              list[8] = "const";
              list[9] = "continue";
              list[10] = "default";
              list[47] = "do";
              list[11] = "double";
              list[12] = "else";
              list[13] = "extends";
              list[14] = "final";
              list[15] = "finally";
              list[16] = "float";
              list[17] = "for";
              list[18] = "goto";
              list[19] = "if";
              list[20] = "implements";
              list[21] = "import";
              list[22] = "instanceof";
              list[23] = "int";
              list[24] = "interface";
              list[25] = "long";
              list[26] = "native";
              list[27] = "new";
              list[28] = "package";
              list[29] = "private";
              list[30] = "protected";
              list[31] = "public";
              list[32] = "return";
              list[33] = "short";
              list[34] = "static";
              list[35] = "strictfp";
              list[36] = "super";
              list[37] = "switch";
              list[38] = "synchronized";
              list[39] = "this";
              list[40] = "throw";
              list[41] = "throws";
              list[42] = "transient";
              list[43] = "try";
              list[44] = "void";
              list[45] = "volatile";
              list[46] = "while";
              //list[47] = "do";
              for(int i=0;i<48;i++)
                   if(keyword.equals(list))
                        return true;
              return false;

    If you had seen my code You would have know that i have inserted JList into scroll pane.
    I have added comments before and after that portion of code to make it easy to notice..
    insert your jList into jScrollPane

Maybe you are looking for

  • Problems with Mini DVI to S-Video/RCA adapter

    Hello I've got a mac mini and I want to pass its image to a television (note: this television doesn't have HDMI) I've bought the Mini DVI to S-Video/RCA adapter, but when I connect it to my TV nothing appers (except some gray lines, which means the s

  • ITunes 11.1 won't connect to AirPort Express

    Hello, I just updated iTunes to ver. 11.1.0.126 from the previous version of 11.0.5.  Prior to this, everything worked fine, no issues ever with connecting to my airport express from iTunes.  Now that I've updated to 11.1 I get the following message

  • How to stop Preview from changing resolution when converting JPEGs into PDF

    I am combining several JPEGs of identical resolution into a PDF using Preview, using either the sidebar or Automator action (http://discussions.apple.com/thread.jspa?messageID=11893607). For some reason, Preview changes the resolution of the PDF so v

  • Group COA....

    Hi Experts I need information regarding Group COA We create Group COA and assign the same to Operational COA in OB13. While creating GL master record we assign Group COA GL account No...Do we need to create this Group COA GL account under FS00 for th

  • My G4 gets into a loop after installing Loepard

    After installing Leopard it worked ok. Turned off system. After start up it goes into a loop with the configuration assistant. I can log in, configuration assistant starts, i fill in everything what is required, come back to login and the same thing