Problem In Awt List

I am Having problem with Awt List component
setSize
setPrefferedSize
setMaximumSize
None is working I have limited screen are to use in applet Hence I want to limit the width of List
Below Is My code I am using in Devloping Some Applet.
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.List;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class ListSizeProblem extends Frame {
     public List list1;
     ListSizeProblem (String t) {
          this.setTitle(t); // setting up the main window
          this.setSize(500, 400);
          this.setLocation(50, 50);
          this.setLayout(new BorderLayout());
          addWindowListener(new WindowAdapter() { // application will exit if window is closed
             public void windowClosing(WindowEvent e) {
                  System.exit(0);
          list1 = new List(15, false);
          //list1.setSize(new Dimension(40,200));
          list1.setPreferredSize(new Dimension(40,200));
          //list1.setMaximumSize(new Dimension(40,200));
           for (int i = 1; i < 21; i++) {
             list1.add("But"+i);
          this.add(list1,BorderLayout.WEST);
          this.pack();
          this.setVisible(true);
     public static void main (String [] args) {
          ListSizeProblem mainframe = new ListSizeProblem("List Size");
}can somebody help me

It is indeed a bug. Once your List has data in it, the getPreferredSize method starts calling preferredSize(int rows) method. This method in turn asks the list's peer for the size. The result is that the preferred size you set is completely ignored (hence a bug). Quick fix would be to override the getPreferredSize method like so.
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.List;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class ListSizeProblem extends Frame {
    public List list1;
    ListSizeProblem(String t) {
        this.setTitle(t); // setting up the main window
        this.setSize(500, 400);
        this.setLocation(50, 50);
        this.setLayout(new BorderLayout());
        addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
                System.exit(0);
        list1 = new List(15, false) {
            Dimension size = new Dimension(40, 200);
            public java.awt.Dimension getPreferredSize() {
                return size;
        for (int i = 1; i < 21; i++) {
            list1.add("But" + i);
        this.add(list1, BorderLayout.WEST);
        this.setVisible(true);
    public static void main(String[] args) {
        ListSizeProblem mainframe = new ListSizeProblem("List Size");
}The list is not 200 pixels high, but this just comes from the fact that you don't have a BorderLayout.NORTH or BorderLayout.SOUTH object yet, so the BorderLayout is alowed to extend the height of the list.
And you seem to havea pretty exact idea on the size you want your components to be. If the frame is not going to be resizable, then you can use no layout manager if you want. This would require you to set the exact bounds of every component you add to the frame.

Similar Messages

  • Some problems in "AWT.List', Pls help !

    Dear all,
    Now i am studying a 'AWT.List'. I would like to know that how can i auto-swap the content on the 'AWT.List' into 2 or 3 line if the length of content is longer than the width of 'AWT.List'. And if it can be implemented, what is the return value of the specific rows ?
    Lung,
    Thx !

    As far as I know, List doesn't allow you to do that kind of thing. However, it could be pretty easily done with a JList and a JTextArea as ListCellRenderer.

  • Problem with Horizontal Scroll on java.awt.List

    I use the same code for a General Application as a CDC Application.
    I have no problem at all with the General Application but on the CDC I can't scroll to the right (horizontal).
    Why do I get this problem on the CDC application and not on a regular application?
    I use the PP-1.0 Profile for the CDC application. Does it not support horizontal scroll on java.awt.List?
    This is the code:
    * Main.java
    * Created on den 22 augusti 2007, 10:52
    package cdcapplication6;
    * @author  Erik Rothman
    public class Main extends java.awt.Frame {
        /** Creates new form Main */
        public Main() {
            initComponents();
              for (int i = 0; i < 10; i++) {
                   list1.add("Short text");
                   list1.add("Some very long text indeed. Some very long text indeed.");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            list1 = new java.awt.List();
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            add(list1, java.awt.BorderLayout.CENTER);
            pack();
        }// </editor-fold>                       
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {                         
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Main().setVisible(true);
        // Variables declaration - do not modify                    
        private java.awt.List list1;
        // End of variables declaration                  
    }

    I use the same code for a General Application as a CDC Application.
    I have no problem at all with the General Application but on the CDC I can't scroll to the right (horizontal).
    Why do I get this problem on the CDC application and not on a regular application?
    I use the PP-1.0 Profile for the CDC application. Does it not support horizontal scroll on java.awt.List?
    This is the code:
    * Main.java
    * Created on den 22 augusti 2007, 10:52
    package cdcapplication6;
    * @author  Erik Rothman
    public class Main extends java.awt.Frame {
        /** Creates new form Main */
        public Main() {
            initComponents();
              for (int i = 0; i < 10; i++) {
                   list1.add("Short text");
                   list1.add("Some very long text indeed. Some very long text indeed.");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            list1 = new java.awt.List();
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            add(list1, java.awt.BorderLayout.CENTER);
            pack();
        }// </editor-fold>                       
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {                         
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Main().setVisible(true);
        // Variables declaration - do not modify                    
        private java.awt.List list1;
        // End of variables declaration                  
    }

  • Display image in java.awt.List

    hello guys,
    How i can display image in java.awt.List means listbox. give me sample code. if you have
    Waiting for your favorable reply.
    Regards,
    Bhavesh Kharwa

    java.awt.List you can not.
    javax.swing.JLast you can.

  • I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    I would like to create a playlist of some of my voicememos to hear on my iphone5. I have no problem creating the list and can listen on playlist on computer but not when i sync to my phone. How can I listen to voicememos in a playlist on my iPhone?

    Hi czigrand,
    Thanks for visiting Apple Support Communities.
    Currently, you can gift dollar amounts or individual items (EG. songs) on the iTunes Store. See this article for more information:
    In the iTunes Store, you can gift a dollar amount or specific music, movies, TV shows, or apps from your iPhone, iPod touch, iPad, Mac, or PC. Follow these steps to send a gift from the iTunes Store.
    iTunes: Sending iTunes Gifts
    http://support.apple.com/kb/HT2736
    Best Regards,
    Jeremy

  • Awt.List Flicker when adding many items.

    I need to add a lot of items to an awt.List (around 100),
    is there a way to do this off-screen so that it wont flicker
    like crazy while I'm adding the items in a loop?
    Thanks,
    Rob.

    you can make your list invisible setVisible(false) when it performed the adding make it visible.You can use Thread.sleep() to stay for a while till adding has not been done!
    hope it will match with ur requirements

  • I am English but I live in Spain. when I try to download an app now, as well as my password i get asked to complete a security question from a list. The problem is the list is in Spanish. How can I turn this additional security off

    I am English but I live in Spain. when I try to download an app now, as well as my password i get asked to complete a security question from a list. The problem is the list is in Spanish. How can I turn this additional security off.
    Please note: I dont speak Spanish.
    Please HELP

    You can't turn it off.

  • Having problem with reading list in safari

    i am having problem with reading list in safari some time it work sometimes gets hang....

    Might be a cache issue ...
    Open a Finder window. From the Finder menu bar click Go > Go to Folder
    Type or copy paste the following:
    ~/Library/Caches/com.apple.Safari/Cache.db
    Click Go then move the Cache.db file to the Trash.
    Quit and relaunch Safari to test.

  • Removing scrollbar from AWT List

    Hi,
    I have an instance of List on my screen. I noticed when I have more than one item on the list, it shows automatically a vertical and horizontal scrollbars.
    I have to disable scrollbars, but cannot find out if it is possible with AWT List or should I opt for a different Component than List.
    Could anyone give me a hand?
    Thank you,
    Caren

    List is what you want. Use this constructor...List(int, boolean). First argument is number of items to display in the list, second is if List is mulitle selection list. So for a normal list with 5 items do this:
    List myList = new List5, false);
    This should stop a scrollbar being put in (unless you add more than 5 items). If this doesn't work it's proably your layout manager set up.
    Hope this helps

  • Short code causes a strange problem - About the list again -- please read!

    Hi again people. Maybe you remember my project - has a list, that you can search thru using a text field. During the work I got stuck on a strange problem ( Again :-( ) My app has one text field, one combo box, one list and a text field once more. The code should do the following ->
    *1. Load the list, no problem with that.*
    *2. Show the elements of the list, that match the selected group in the combo box,no problem.*
    *3. Search thru the list using the text field,no problem.*
    4. When the user selects an element from the list, it should display its info in the second text field. This also works fine, but when after looking at info of one of the elements the things on numbers 2 and 3 ( look up! ) stop working. I must say that everything works fine until user selects an element from the list. I couldnt understand this kind of behavior so I am asking you to help me please.
    The code is very simple:
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    class the_window extends JFrame implements DocumentListener, ItemListener, ListSelectionListener {
        FileReader reader;
        String data_base[][];
        String first_pass[];
        int number_of_elements;
        DefaultListModel dflm = new DefaultListModel();
        JList list;
        JTextField text_field = new JTextField();
        JTextField info_field = new JTextField();
        String groups[] = {"1. group" , "2. group"};
        JComboBox groups_cmbx = new JComboBox(groups);
        the_window(){
            super("the Window!");
            JPanel panel = new JPanel(null);
            Container c = this.getContentPane();
            c.add(panel);
            text_field.setBounds(10,10,170,25);
            text_field.getDocument().addDocumentListener(this);
            panel.add(text_field);
            groups_cmbx.setBounds(10,45,170,25);
            groups_cmbx.addItemListener(this);
            panel.add(groups_cmbx);
            list = new JList(dflm);
            list.setBounds(10,90,170,190);
            list.setFixedCellHeight(20);
            list.addListSelectionListener(this);
            panel.add(list);
            info_field.setBounds(10,280,170,25);
            panel.add(info_field);
            load_the_base();
            refresh();
            this.setSize(190,350);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setResizable(false);
            this.setVisible(true);
        public void itemStateChanged(ItemEvent e){
            refresh();
        public void valueChanged(ListSelectionEvent e){
            String str = (String) dflm.getElementAt(list.getSelectedIndex());
            int index = 0;
            for(int i = 0; i < number_of_elements; i++){
                if(str.equals(data_base[0])){
    index = i;
    break;
    info_field.setText(data_base[index][1]);
    private void load_the_base(){
    String data = "";
    try{
    reader = new FileReader("data.txt";);
    int r = 0;
    while((r = reader.read()) != -1){
    char c = (char) r;
    data += c;
    reader.close();
    }catch(IOException e){}
    first_pass = data.split(";");
    number_of_elements = first_pass.length;
    data_base = new String[number_of_elements][];
    for(int i = 0; i<number_of_elements; i++){
    data_base[i] = first_pass[i].split("#");
    private void refresh(){
    String search_str = text_field.getText();
    int selektovano = groups_cmbx.getSelectedIndex();
    dflm.clear();
    for(int i = 0; i < number_of_elements; i++){
    int grupa = Integer.parseInt(data_base[i][2]);
    if(grupa == selektovano){
    String at_the_moment = data_base[i][0]; // if you change this to String at_the_moment = data_base[i][1]; it works perfectly
    if(at_the_moment.startsWith(search_str)){
    dflm.addElement(at_the_moment);
    public void changedUpdate(DocumentEvent e){
    refresh();
    public void removeUpdate(DocumentEvent e){
    refresh();
    public void insertUpdate(DocumentEvent e){
    refresh();
    public class Main {
    public static void main(String[] args) {
    JFrame f = new the_window();
    Now, can you please tell me whats wrong with this?
    For the "data.txt" make a new text file using *notepad* and copy the following line into the document:
    _1. element#1. info#0;2. element#2. info#0;3. element#3. info#1;4. element#4. info#1;5. element#5. info#1;_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Darryl.Burke wrote:
    Keith, thanks for making that readable. So here's the diagnosis -
    In the refresh() method, calling defaultListModel.clear() results in a valueChanged(...) event in which this method calldefaultListModel.getElementAt(list.getSelectedIndex())results in the exception noted, as getSelectedIndex returns -1, the list being empty... you can't getElementAt(-1).
    I haven't analyzed all the code nor checked whether is now works as desired, but this small change to valueChanged counters the exception being thrown.   public void valueChanged(ListSelectionEvent e) {
    infoField.setText(""); // do this unconditionally
    if (list.getSelectedIndex() != -1) {
    String value = (String)defaultListModel.getElementAt(list.getSelectedIndex());
    for(int i = 0; i < numFields; i++){
    if(value.equals(matrix[0])){
    infoField.setText(matrix[i][1]);
    break;
    db
    Yea! You were right! I didnt think that calling *list_model.clear();* will result in calling *valueChanged()* ........
    That was some *clear()* thinking :-) Thank you!
    corlettk wrote:
    I cleaned up some variable & method names (tut tut), imports (very naighty), and some thread stuff... but it remains fundamentally the same codeIs it so important to "clean" the imports? How much does it slow down the loading time? Should I do this on all my projects, because they are all "very naighty"?
    ps. Thanks to all that gave some help to answering this strange question :-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem in Array List

    Hi Friends,
    The below problem occurs while assigning bulk records to arraylist
    com.sun.corba.se.impl.encoding.CDRInputStream_1_0 checkBlockLength
    WARNING: "IOP00810201: (MARSHAL) Data read past end of chunk without closing the chunk"
    org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 201 completed: No
         at com.sun.corba.se.impl.logging.ORBUtilSystemException.chunkOverflow(Unknown Source)
         at com.sun.corba.se.impl.logging.ORBUtilSystemException.chunkOverflow(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.checkBlockLength(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_2.alignAndCheck(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_longlong(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_double(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream.read_double(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.inputPrimitiveField(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.inputClassFields(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
         at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
         at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_abstract_interface(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream.read_abstract_interface(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.readObjectDelegate(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.readObjectOverride(Unknown Source)
         at java.io.ObjectInputStream.readObject(Unknown Source)
         at java.util.ArrayList.readObject(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.invokeObjectReader(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.inputObject(Unknown Source)
         at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
         at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
         at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
         at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
         at com.kgisl.kurnia.administration.ejb._AdministrationEJB_Stub.agentfindAll(_AdministrationEJB_Stub.java:296)
         at com.kgisl.kurnia.administration.FrmAgentProfileCT.FnLoadTree(FrmAgentProfileCT.java:101)
         at com.kgisl.kurnia.administration.FrmAgentProfileCT.<init>(FrmAgentProfileCT.java:301)
         at com.kgisl.kurnia.administration.FrmClientTransfer.btnFromAccCodeActionPerformed(FrmClientTransfer.java:314)
         at com.kgisl.kurnia.administration.FrmClientTransfer.access$2(FrmClientTransfer.java:313)
         at com.kgisl.kurnia.administration.FrmClientTransfer$4.actionPerformed(FrmClientTransfer.java:432)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Thanks in Advance

    A) Use a java.util.Set
    B) Create a java.util.List from the Set and use Collections.sort()
    ~

  • Scrollbars and awt.List

    Hello,
    I'm a first year student form the Netherlands in software design. And as of this semester I'm getting Java (finally a new language to learn!). Everything has gone very smoothly, I was hoping of more of a challenge trying to learn it, but it goes very easily (maybe I shouldn't have programmed in C++ for 3 years :P).
    Though now I'm having a slight problem with my code. v _ v '
    My project has to be competly in awt widget's, and I thought I'd do something more than required (it would seem that my teachers expect me to ^ _ ^).
    In this list I'm required to use a fixed width font to "simulate" 2 panels (almost similar to the TableList in Swing) with a pipe ( | ) character as a line. It means that I need to cut off words that cross the boundry.
    The above (and the rest of the assignment) works perfectly (and I've done the actual required part in less than 30 minutes), but now I've come to want to add tool tips to all the elements.
    I've made a tooltip class (it works btw), but I need to get the item in the list my mouse is hovering over.
    I believe a row is 20 pixels high (or something like that), so I divide the y value (of the local mouse position) by 20 and use the integer part as the index.
    And here comes the problem.
    When the list scrolls then the method I described above won't work anymore.
    I think that my method is (atleast) similar as to what other programs do, save that it adds the scroll info as well.
    Now here's my real problem. I can't (or don't know how) to get the scrollbar info from the list. I know there's a handy function is Swing, but I'm only allowed to use awt.
    I've also read that the scrollbars are part of the peer's (native to the OS) so I can't access them.
    So my true question is, what (if any) event should I listen to, to get scroll movements (not mouse wheel scrolling)?
    And if there isn't any way to listen to the events, then do you have any idea how to tackle this problem?
    Thank you for your time,
    MLeoDaalder

    Showing me your misbehaving output is not helpful.
    I have successfully implemented what you are attempting, using Swing which I understand you cannot use but it should work the same way using AWT.
    My main class extends JFrame (you would extend Frame) and implements MouseMotionListener. The mouseMoved(MouseEvent evt) method in the main class updates the tool tip, based on the evt.getX() and evt.getY().
    I have a class (call it LCanvas) that extends JPanel (you would extend Panel) . The class adds a MouseMotionListener and has a paint(Graphics g) method that records the borders of each line that gets painted by g.drawString(String s, int x, int y). (Some of the painted lines may be outside of the displayed area.)
    When I construct LCanvas, I pass it the JFrame (you would use Frame) of the main class. So my contructor looks like:
    public LCanvas(JFrame f) {
    addMouseMotionListener((MouseMotionListener) f);
    Back in main(String [ ] args), I set up my scrollable window as:
    MainClass f = new MainClass();
    LCanvas lc = new LCanvas(f);
    JScrollPane sp = new JScrollPane(lc);
    content_pane.add(sp);
    I don't know how you are trying to implement this but you should be able to compare it to my implementation that works and, since you are such a clever guy, figure out what's going wrong.

  • Problem retrieving a list of values with XPATH

    Hi,
    I am trying to get a list of all 'Fields' (under the SubscriptionList -> EconomicIndicator -> Code) which have 'Provider' =DJ.
    I am using the below xpath expression. But It is not working. I tried other variations but none of them return mulitple items.
    Can some one please tell me if Iam missing something.
                   XPathExpression xPathExpression= xpath.compile("/SubscriptionList/EconomicIndicator[*]/Code[Provider=DJ]/Fields");
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
              System.out.println(element.getNodeValue());
    <?xml version="1.0" encoding="UTF-8"?>
    <SubscriptionList>
    <DefaultEconomicIndicatorName>US ADP Employment Change</DefaultEconomicIndicatorName>
    <!--GE IFO - Business Climate-->
    <EconomicIndicator>
    <Name>GE IFO - Business Climate</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-22T03:50:00</StartDate>
    <EndDate>2007-06-22T04:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRIFPBUS</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEBUSS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>GM_IFO</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>GM_IFO_BUSSENTIMENT_Cur</Fields>
    </Code>
    </EconomicIndicator>
    <!--GE Producer Prices (MoM)-->
    <EconomicIndicator>
    <Name>GE Producer Prices (MoM)</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-20T01:50:00</StartDate>
    <EndDate>2007-06-20T02:10:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>GRPFIMOM</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>DEPPI=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Trends - Orders</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIO=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--UK CBI Industrial Trend-->
    <EconomicIndicator>
    <Name>UK CBI Distributive - Trades</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-06-21T05:50:00</StartDate>
    <EndDate>2007-06-21T06:10:00</EndDate>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>GBCBIS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    </EconomicIndicator>
    <!--US Unit Labor Costs-->
    <EconomicIndicator>
    <Name>US Unit Labor Costs</Name>
    <Active>0</Active>
    <OutputFormat></OutputFormat>
    <OutputUnits>1</OutputUnits>
    <StartDate>2007-09-06T08:20:00</StartDate>
    <EndDate>2007-09-06T08:40:00</EndDate>
    <Code>
    <Provider>BB</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB1</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB2</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>BB3</Provider>
    <Service>Index</Service>
    <InstrumentCode>COSTNFR%</InstrumentCode>
    <FID>PX_LAST</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>RFA</Provider>
    <Service>IDN_SELECTFEED</Service>
    <InstrumentCode>USLCTS=ECI</InstrumentCode>
    <FID>356</FID>
    <Units>1</Units>
    <Fields></Fields>
    </Code>
    <Code>
    <Provider>DJ</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    <Code>
    <Provider>DJS</Provider>
    <Service></Service>
    <InstrumentCode>US_PROD2_REV</InstrumentCode>
    <FID></FID>
    <Units>1</Units>
    <Fields>US_PROD2_REV_UNITLABORCOST_CurQChgPct</Fields>
    </Code>
    </EconomicIndicator>
    </SubscriptionList>

    Hi DrClap,
    I have a similar problem again. This time I am trying to extract a list of values from a xsd. Below is the code that I am using.
              try{
                   djxsd = new FileInputStream("djei-3.1.xsd");
                   XPathFactory factory = XPathFactory.newInstance();
                   XPath xpath = factory.newXPath();
                   SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
                   xpath.setNamespaceContext(nsContext);
                   nsContext.addNamespace("xs", "http://www.w3.org/2001/XMLSchema");
                   nsContext.addNamespace("xsi","http://www.w3.org/2001/XMLSchema-instance");
                   +//String exp = "//xs:element/@name/text()";+               
    String exp = "/xs:schema/xs:group/xs:sequence/xs:element";
                   XPathExpression xPathExpression= xpath.compile(exp);
                   NodeList result = (NodeList)xPathExpression.evaluate(doc, XPathConstants.NODESET);
                   FileOutputStream outputfile = new FileOutputStream("log.txt");
              for (int i = 0; i < result.getLength(); i++) {
                   Element element = (Element)result.item(i);
                   String output = element.getTextContent().trim();
                   if(output.length() > 0)
                        outputfile.write(output.getBytes());
                        //System.out.println(output);
    Highlighted in Itlalics is the actual expression that I want to use. For some reason this is not working .. it returns nothing.
    The other expression works. Please let me know if there is anything wrong with the expression.
    THE XSD FILE
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" elementFormDefault="qualified">
         <xs:element name="DJEconomicIndicator">
              <xs:complexType>
                   <xs:sequence minOccurs="0" maxOccurs="unbounded">
                        <xs:group ref="allgroup"/>
                   </xs:sequence>
                   <xs:attributeGroup ref="TopGrp-Attributes"/>
              </xs:complexType>
         </xs:element>
         <xs:group name="allgroup">
              <xs:sequence>
                   <!-- ==================== CPI ========================== -->
                   <xs:element name="US_CPI_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Unrounded==================== -->
                   <xs:element name="US_CPI_Unrounded_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI UnRounded</xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <!-- ==================CPI Core Index==================== -->
                   <xs:element name="US_CPI_Core_CurMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>
                   <xs:element name="US_CPI_Core_ExpMonChgPct" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation> US Consumer Price Index </xs:documentation>
                             <xs:appinfo> CPI Core </xs:appinfo>
                        </xs:annotation>
                        <xs:complexType>
                             <xs:annotation>
                                  <xs:appinfo> Forecast MoM Pct Change (Current Period) </xs:appinfo>
                             </xs:annotation>
                             <xs:simpleContent>
                                  <xs:extension base="xs:double">
                                       <xs:attributeGroup ref="common-month"/>
                                       <xs:attributeGroup ref="common-attributes"/>
                                  </xs:extension>
                             </xs:simpleContent>
                        </xs:complexType>
                   </xs:element>

  • Is there a way to fix ipod touch screen display problem with song list?

    I was wondering if anybody has had this problem? I have an ipod touch 64gig 5th gen for probably about 2 years. I hardly use it because I have it as a back up ipod until primary one dies. This is the first time I came across this problem. Upon turning on device, the first artist/song list I choose displays correctly. Once I start choosing any other artist/song list afterwards, the display for the 1st artist/song list re-appears. If the song list is only a single song to 3-4 songs it will display correctly. Any other song list I choose that consist more than 5 songs, the first artist/song list re-appears on screen like the display is messed up.
    For example: Upon turning on device, I choose Aaliyah with a list of 9 songs displaying.
    Upon trying to select a different artist and song, for example I choose Nachtmar with a  list of 20 songs.
    The Aaliyah with the list of 9 songs re appears in place of the song list I am attempting to choose. The songs play and it works, but the display is incorrect. Why is it doing this? Does anybody have this problem? I have tried resetting and it has currently been updated. I have came across this problem just very recently a couple of days ago. I have had a couple of hard resets requiring to erase all data in the past and I don't want to go that way again because I have about 3,500 songs. I have never experience this problem before in the past. I just want it to display the current list of songs. It's inconvenient having to type in every song while playing in the car instead of being able to easily pick an individual song.

    I have this problem too and it drives me crazy. When I view my ipod, I don't want to see a list of the first 8 songs in my ipod library. I just want to see the current song playing. It's like the ipod display goes into some type of "sleep" mode while your music plays,and the display defaults to show the first few songs in your ipod touch library, even though none of those songs are currently being played. I have to take the time to either flip the ipod over a couple of times in order for that list to disappear just to see the current song playing.
    This is an example of what I see on my display after the current song begins playing. These are the first songs in my ipod library. To get rid of this view, I have to either shake the ipod or flip it over a couple of times and the current song is now displayed, allowing you to see the current song, also allowing you access to the arrows to either fast forward or playback/reverse. On the display, the songs are in a grid or table format (unable to show that here).
    Acoustic Soul
    Aaliyah
    Adventers on the Wheels
    Adventures in Paradise
    After Tonight
    Will Downing

  • Problem with customized "List of GR/IR Balances" Program

    Hi Guru,
    My company has developed a program which is adopted from Transaction MB5S: List of GR/IR Balances.  This new program has been developed to have one more field which is delivery date field on the filter page.  However, when users run this program by filtering delivery date.  The system takes too long to execute this program and runtime error page is displayed due to exceed the maximum runtime limit.
    Currenty, I avoid this problem by executing this program in background mode.  Therefore, users must use T-Code ST02 to view the report. 
    My question is the solution on this problem, therefore, user can execute this program normally in foreground mode without running in background and view report using ST02.  Anyone could suggest me on this case?   Point will be rewarded to you.
    Thank you,

    Hi,
    You may check if either of the following serves your purpose, though I don't think there is any query that would give you both IR/GR:
    0FIGL_M40_Q0001
    0CSAL_C01_Q0020
    0CSAL_C01_Q0021
    0IPM_MC02_Q0001
    0IPM_MC02_Q0002
    0SAL_DS01_Q0003
    0SAL_DS01_Q0002
    0SAL_C01_Q0009
    Rgds,
    Sonal

Maybe you are looking for

  • BLOCK/UNBLOCK GR/IR Account in Master Data

    Team, I Blocked at Company level GR/IR account to update open item management. After the program finished I went back and unblocked account, I am able to post directly to the account, however it appears that receiving was in teh middle of receiving g

  • How to know that a method has been called and returning value of a method

    Hi, everyone! I have two questions. One is about making judgment about whether a method has been called or not; another one is about how to return "String value+newline character+String value" with a return statement. Here are the two original proble

  • Qty field addtion based on item no. for ekbe table

    Hi experts,                   below is my code.. LOOP AT IT_EKKO.   READ TABLE IT_LFA1 WITH KEY LIFNR = IT_EKKO-LIFNR.    MOVE: IT_LFA1-NAME1 TO IT_DISPLAY-NAME1.    MOVE: IT_EKKO-LIFNR TO IT_DISPLAY-LIFNR,          IT_EKKO-AEDAT TO IT_DISPLAY-AEDAT,

  • CV01N - Attached PDF document printing through programmatically

    Hi all My requirement is to print PDF document which is attached through CV01N transaction programmatically. I searched all the ways. Still I didn't get it. Kindly help me to achive PDF document printout programmatically. Thanks in advance. Thanks an

  • FileInputStream() I/O in J2ME

    Hi all... I want to ask something. Is there any way to make a new file or read something from a file on handhelds application, because I read the J2ME API and it said that some I/O functions in J2EE like FileInputStream and FileOutputStream are exclu