• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to set icon at net beans

 
Greenhorn
Posts: 9
Netbeans IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.


 
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
Netbeans IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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. :/
 
Ranch Hand
Posts: 4716
9
Scala Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my advice, if you want to become a programmer, ditch netbeans and go
 
Marshal
Posts: 79153
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Randall is right. And welcome to the Ranch
 
Nitin Surana
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9
Netbeans IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Greenhorn
Posts: 23
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 :

 
Nitin Surana
Ranch Hand
Posts: 129
Netbeans IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use Netbeans only, but I prefer hand-coding rather than drag-n-drop.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Edmund Petrof
Greenhorn
Posts: 9
Netbeans IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 >.<
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Edmund Petrof
Greenhorn
Posts: 9
Netbeans IDE Opera
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic