Solved

help with JPopUpMenu & JList

Posted on 2004-08-15
8
1,446 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now