Solved

Creating custom swing componenets

Posted on 2006-11-23
8
250 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

679 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