Solved

Creating custom swing componenets

Posted on 2006-11-23
8
244 Views
Last Modified: 2012-06-27
If I want to create my own JComponent, how would I do that?
For example If i wanted to create my own textbox component, where would I start?
If someone could point me in the right direction with online tutorials or something, that would be great.
0
Comment
Question by:farhadabas
  • 3
  • 3
  • 2
8 Comments
 
LVL 10

Expert Comment

by:ADSLMark
ID: 18004136
You should make a class extending JComponent. Take a look at this website:

http://72.5.124.55/docs/books/tutorial/uiswing/painting/practice.html

Mark
0
 

Author Comment

by:farhadabas
ID: 18004645
I have read that but how about more detailed things like setting the events and different states.
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 18006155
For custom events, you should provide a set of methods for others to register for them
addXXXListener, removeXXXListener, fireXXX
http://www.javaworld.com/javaqa/2000-08/01-qa-0804-events.html
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:farhadabas
ID: 18010041
0
 
LVL 10

Expert Comment

by:ADSLMark
ID: 18010605
How about this question on the sun java forum:

http://forum.java.sun.com/thread.jspa?threadID=745297&messageID=4267482

Mark
0
 

Author Comment

by:farhadabas
ID: 18012435
the above is good but i was thinking something more complete, a whole tutorial on making a component from scratch and adding listeners in it and stuff
0
 
LVL 10

Accepted Solution

by:
ADSLMark earned 115 total points
ID: 18012440
I understand, maybe this helps:

http://www.onjava.com/pub/a/onjava/2004/08/11/desktop.html

Mark
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 18012473
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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…

860 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