Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create an "icons area" ?

Status
Not open for further replies.

stemy

Programmer
Aug 25, 2001
39
IL
Hi

I need to create in java a screen similar to the "New Office Document" screen in "Microsoft office". Meaning, I need a tabbed panel, and each tab has to have an area filled with icons. I know how to make the tabs but I don't know how to create such icons in java.
thanx.
 
Easy... create a labal, then..

jLabel1.setIcon(new ImageIcon("C:/WINDOWS/Help/Tours/WindowsMediaPlayer/Img/Btn/taoff.gif"));

You could use JButtons, if you want to fire events when clicked.
 
Thanx. That is easy.
But now, let's say I want to toggle between Icon's view/ list view/ Details view and so on, again, just like in office. Let's say for simplicity I'm browsing through files on the filesystem.
 
That all seems very straight forward, but I'll leave you to implement it!!. Remember to start thinking in terms of model-view-controller. The model is the data you wish to interact with, e.g. files in directoryies. The view will be the tabbed panels/icons etc, and the control will be the listeners that react to mouse clicks.

One could create multiple "views" of the same data, one could be a table of details, e.g. filename, size, date last modified. Another view could be an array of icons (thumbnails). When the user chooses an atlernative view option, you simply change the "view"; the underlaying data model remains the same.

If you now know how to create a panel of labels with icons. It will be just as simple to creat a panel containing a table, which can replace the icon panel at the users descretion. simple.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top