Solved

help with JPopUpMenu & JList

Posted on 2004-08-15
8
1,490 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
[X]
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
  • 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

630 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