Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

help with JPopUpMenu & JList

Posted on 2004-08-15
8
1,474 Views
Last Modified: 2012-08-13
Hi there,

I'm using NetBeans. I cant figure out how the JPopUpMenu comes on the panel. i have made a panel and when i click on JPopUpMenu and place it on the editor, i cant see anything. It just comes in the other components list . And it doesnt show any property.

The other question is about list. I need to make a dynamic List. The list is like that of MSN . Offline contacts, online contacts. Again the netbeans dont allow me to change the list members. do i have  to write some code for it.

plz help,

...
0
Comment
Question by:ganatra
  • 2
  • 2
8 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11807505
I am not sure I understand what you mean by saying how the popup menu comes up. It shold be displaed when the user takes the appropriate action. For examples look here: http://javaalmanac.com/egs/javax.swing/Popup.html

For the list, you just create a list reference and then keep adding objects there:

List list = new ArrayList()
list.add("hello");
...

But I am not sure if we are talking about the same lists. What exactly is an MSN list?
0
 

Author Comment

by:ganatra
ID: 11851093
sorry Venabili..

actually i was waiting for some other comment. let me give some good hint..

every body must have seen the emoticons in msn or yahoo messenger.  when you click on the smiley box, a window opens with the list of smileys and let you choose the one you want. i want similar thing.. in java swing.

got it ?

plz help..
0
 
LVL 20

Expert Comment

by:Venabili
ID: 11851129
ganatra,

Noone will comment if they see that you had not answered to an expert trying to help you. In most cases this means that you do not care for the question (or that you still do not know how the site works). So for receiving faster and better responces, always answer to the experts trying to help you:)

So you need a popup with a table and not a list in it?
Can you post the code that you had written for the popup? How it is shown, how it is initiliased and so on?

Venabili
0
 

Author Comment

by:ganatra
ID: 11919463
here is the icon declaration..

ImageIcon myimage = new ImageIcon("C:\\abc.gif");

and here is the usage code.

jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {myimage, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jPanel1.add(jTable1);


now when i run this.. i get C:\abc.gif written in the table field and not hte image..

i need the image..

can u help..
0
 
LVL 35

Accepted Solution

by:
girionis earned 50 total points
ID: 11970798
Look here for examples of how you can put icons into jtable: http://www.senun.com/Left/Programming/Java_old/Examples_swing/JTableExamples8.html
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question