Solved

Creating custom swing componenets

Posted on 2006-11-23
8
257 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

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

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

628 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