Stuart Gray

Ranch Hand
+ Follow
since Apr 21, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stuart Gray

You want to perform an action when you click on your two labels, right? In that case it might be better to make them buttons instead (use JButton instead of JLabel).

Assuming your Registration, Allocation, and ChangeStatus are text fields, try something like this:

Create your three textfields.
Add them to a JPanel
Use the setVisible method to make them invisible at first.
Add an ActionListener to each of your buttons
The Action Listener for the first button will make all three text fields visible (using setVisible)
The Action Listener for the other button will only make the Registration field visible.
12 years ago
AFAIK there are no facilities to read files bit by bit, but you can read one byte at a time. So to get 128 bits of data, just read (128 / 8 = 16) bytes.
12 years ago
It seems you are looking for an API that will solve most of the problem for you, and I really don't think that is going to happen. You might find the Graphics2D API useful when you get deeper into your project but it seems to me you need to break the problem down and define it more accurately: so you want to find all skin regions, right? What constitutes a skin region? How is such a region defined? How do you tell the difference between a person and a background that has a similar colour to that person's skin? This ignores other issues of varying skin colours, lighting, etc.

When you can answer those questions and come up with some possible solutions, you will find the question of choosing the right API much easier
12 years ago
The EditorPane/HTMLEditorKit are quite limited still - applets are one of the things that cannot display (at least, I have never been able to make them do so!).
12 years ago
Yes, as of JDK 1.4 (IIRC) you can use methods in the JFrame class to set the frame to be full screen.
12 years ago
Colours are made of red, green, and blue (RGB) components, each of which (in 24-bit colour) can have values from 0 to 255 inclusive. The higher the value, the 'more' of that colour is available.

To generate your colours, start green at 255 (i.e. 100%), and red and blue at 0. Each iteration of your loop, reduce the green component and increase the red component. Leave the blue component alone.

The amount you increase or decrease by each iteration can be found with the formula: increment = 255/(no of colours - 1)

Hope this helps.
12 years ago
I'm not sure I fully understand your request. Did you check out the Java tutorial section on JFileChooser? It contains information on how to display the appropriate type of dialog. You can configure it for Open, Save, directories or files only, and so on.

You only really use JFileChooser to get File instances using the getSelectedFile() method. Once you have this you can find the path of the selected file and then take the appropriate action (create it if the action is a save; open the file and read it for loading; just display the path as a string for information, etc).
12 years ago
You should look into extending one of the Component subclasses and then overriding its paint method. You can then use one of the methods of the Graphics class to draw your image.
12 years ago
The problem is that the JEditorPane component is not very advanced at the moment. I hit a similar problem before and gave up whilst looking for a third-party component to render HTML. I think you will have to try and better my search (probably not too difficult) or possibly even write your own component. Good luck!
12 years ago
Have you called setDefaultCloseOperation(EXIT_ON_CLOSE) on any of your JFrames? That would do what you describe.
12 years ago
The performance may well vary depending on I/Ospeed, memory, CPU speed (i.e one of the two methods may be more affected by one of these variables than the other). Why don't you run some simple tests to find out?
13 years ago
I would say it depends on many things, some of which might be the size of the project, the type of project, the preferences of existing and potential users, and you and your team's familiarity with other technology.
13 years ago
Exactly which of the 'various exceptions' are you getting, and on which line(s)?
13 years ago
A few things to consider:

Firstly, there is no "array.avg()" method, so either way you will have to do the calculation yourself.

Secondly, if you used an array there is no guarantee that it will always be able to hold all your values, unless you know the maximum possible number of values, which I assume you don't.
13 years ago
Never used it myself, but I've often heard Jakarta POI recommended for this kind of task.
13 years ago