GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes How to set icon at net beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to set icon at net beans" Watch "How to set icon at net beans" New topic
Author

How to set icon at net beans

Edmund Petrof
Greenhorn

Joined: Jan 09, 2012
Posts: 9

Hello, i am new at java, i would like to know better.

I have working at netbeans and I got preaty much what I need. I got table and labels for the data.

Now I put some jlabel and i wana to display image from path what can be see at jtextfield. So how I achive that in netbeans.

Additional info. Table have longvarchar for path what I wana to display. ( donno if i should change it.)
I have put jLabel into Jpanel all in gui.

I was plan to make a Jfilechooser to get Path of file to JtextField but that will do later.


Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

I have already posted an example for something related to what you are trying to do. Here is the example link

http://www.onlinexamples.com/showfullexample.action?idexamples=81&title=Display%20Image%20In%20Jlabel%20Within%20A%20Jpanel

Hope so this will help.
Edmund Petrof
Greenhorn

Joined: Jan 09, 2012
Posts: 9

Nitin Surana wrote:I have already posted an example for something related to what you are trying to do. Here is the example link

http://www.onlinexamples.com/showfullexample.action?idexamples=81&title=Display%20Image%20In%20Jlabel%20Within%20A%20Jpanel

Hope so this will help.


Wow, that is exelent, i wish i know how to make code like that. In the future I hope I would doo the same.

How I implement that code into netbeans? He dont alow me to edit generated code, so that is a bit problem, if i try to import something i got error on startup and then is bad code. :/
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

my advice, if you want to become a programmer, ditch netbeans and go


SCJP
Visit my download page
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39084
    
  23
Randall is right. And welcome to the Ranch
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

Nice to hear that my example helped you.

How I implement that code into netbeans? He dont alow me to edit generated code, so that is a bit problem, if i try to import something i got error on startup and then is bad code. :/


I never liked the generated code, so I always preferred to code myself(didn't like drag-n-drop much). Moreover, doing that clears the basics and debugging is far easier in hand-written code.


Edmund Petrof
Greenhorn

Joined: Jan 09, 2012
Posts: 9

Ok what program to use? What you suggest?

Whit netbeans I make some nice application, wroking nicly just image is my problem. And I am not good at Hand code, Still a bit confused about bunch of stuff, but i got books and reading it daily, some books are for netbeans and other is for java, difrance is big. Like reading two difrante programing language. In netbeans is all about propertis and adding some words, in java all can be typed in the notpad.

So leave netbeans and go notpad? or some other program what you will recommend?

Digen Mahara
Greenhorn

Joined: Dec 23, 2011
Posts: 23

Edmund Petrof wrote:Ok what program to use? What you suggest?

Whit netbeans I make some nice application, wroking nicly just image is my problem. And I am not good at Hand code, Still a bit confused about bunch of stuff, but i got books and reading it daily, some books are for netbeans and other is for java, difrance is big. Like reading two difrante programing language. In netbeans is all about propertis and adding some words, in java all can be typed in the notpad.

So leave netbeans and go notpad? or some other program what you will recommend?



use eclipse IDE the best for Java Programmers, but only thing you wont find there is,it does not use the drag and drop components as in NetBeans used only for coding purpose but excellent.

further your Image problem can be solved:
You can use a JPanel and use the paintComponent() method and drawImage() method to draw an image on the background and there may be a way you can do this in Netbeans, but try this

I tried to implement the following code and it worked fine :



To every Tunnel there is always a way out
So keep Trying...
Nitin Surana
Ranch Hand

Joined: Jan 21, 2011
Posts: 129

I use Netbeans only, but I prefer hand-coding rather than drag-n-drop.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4572
    
    5

Digen Mahara wrote:use eclipse IDE the best for Java Programmers

There's no 'best' IDE. Choice of IDE is based on personal preference, except where decided by employment terms.

Digen Mahara wrote:further your Image problem can be solved:
You can use a JPanel and use the paintComponent() method and drawImage() method to draw an image on the background and hard luck there is no way you can do this in Netbeans try it in Eclipse

Just because you don't know how to do that in NetBeans doesn't mean there's no way. Please state opinions as opinions, not as facts.


luck, db
There are no new questions, but there may be new answers.
Edmund Petrof
Greenhorn

Joined: Jan 09, 2012
Posts: 9

Huh, I dont quite understand.

This is what i know. I learn at netbeans how to pass data from Panel to main project, My question was how to make panel who will read path to image, and display at icon. I allready make some Test project whit new Splash screan and new Project Icon .


Now i am confused as Hell.
So basicly i need to drop netbeans generated code and code all by my self?

@Digen Mahara

I can make class in project for that code, but donno how i can use it, but is interesting code. Worst Part i dont know how to call custom made class in project to main project >.<
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Edmund Petrof wrote:
So basicly i need to drop netbeans generated code and code all by my self?


No.

Any possible Java program can be written in NB, and in Eclipse, and in IntelliJ, and using Notepad. It's just text. What IDEs offer you is higher-level features to make certain tasks easier or less error prone. One poster suggested that NB doesn't have features that you might want. Use the tool that works best for you. I've never used NB, so I can't comment on it, but if you're able to work effectively with it, then there's no real need to change. On the other hand, if there's a particular aspect to development where you find yourself saying, "Man, I wish NB had feature X to make this task easier," then there's a good chance that some other IDE does have that feature.

It is worth trying out other IDEs at some point anyway, just to see what features they offer and what their overall environment is like. You may find you like one better, or you may find that NB still suits your needs.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3606
    
  15
You can edit the NB generated ui code by deleting the .form file that it creates alongside each .java file. Of course the ui editor may not work properly after you delete the .form file (or it may overwrite any manual changes you make), so you will have to do any later changes to the ui by hand, but at least this way you get all the initial grunt work done for you.


Joanne
Edmund Petrof
Greenhorn

Joined: Jan 09, 2012
Posts: 9

whit this tutorial i pass data from custom form to main Master Table, quite good actualy and working fine. http://weblogs.java.net/blog/pkeegan/archive/2008/05/beans_binding_b.html

I was hoping That i can doo same whit image bind to colum and display at APP.

I have reading tutorial http://netbeans.org/kb/docs/java/gui-image-display.html


To view the generated code:

In the GUI Designer, click the Source tab.
Scroll down to the line that says Generated Code.
Click the plus sign (+) to the left of the Generated Code line to display the code that the GUI Designer has generated.

The key line is the following:

Since you have used the property editor for jLabel1's Icon property, the IDE has generated the setIcon method. The parameter of that method contains a call to the getResource() method on an anonymous inner class of ImageIcon. Notice that the generated path for the image corresponds with its location in the application's package structure.


So basicly i need to make getPath for icon and bind to Mastertable Elements ( longVarchar or Varchar whit 255 char whit in ) I think that can be on to something.

Btw I am thinking outload here, so any mistakes what I say please dont take it to hard, becouse i am a newbie at java. Thank in advance.
 
GeeCON Prague 2014
 
subject: How to set icon at net beans