Java Image Handling - java

I am trying to do a poker hand simulator. I am using Netbeans, and by the means of its GUI editor I created a JFrame in which I added the JPG of the poker table. After doing this, is it possible to dynamically add JPGs according to the hand that the player has over the poker table JPG? Is it possible to add a JPG over another? If so, how can I achieve this in NetBeans?
What I am planning to do is display all the players at the table, together with their stack and name and display their action. All this will be done with cards face up. The simulator will calculate some odds and will output some hand details in a pdf.
I want to mention that this is a homework project.

What you are after should be possible. I would recommend you take a look at the Layouts offered by the Swing Framework and once you will find what you need you can take a look here to see how you can implement the layout of your choice.
EDIT: If you are satisfied with how is your application is laid out, you should take a look at the ImageIO to see how you can load JPG images on the fly and add them to your JPanels. Usually one would use the JLabel(Icon image) constructor to add images to JPanels but there are other methods.

Related

How to automatically create jFrames using templates?

Brief overview of my program: records statistics about a local football team such as goals, assists etc for each player in the team. The team will consist of 20 players at most.
The program needs to create new pages when a new player is added to the team. Currently I am using jFrames for pages and do not know how to automatically create new jFrames from within a jFrame. The new pages also need to have a structure e.g. title, text boxes (could this be done using a template of some sort?).
I do not know how to accomplish this..
Thanks
I do not know how to accomplish this..
usage of prepared components in GUI builder can be a disadvantage
you can to start to reading Oracle tutorial Using Swing Components
Currently I am using jFrames for pages and do not know how to
automatically create new jFrames from within a jFrame.
use CardLayout instead of multiple JFrames

Manipulating multiple images and text

I'm trying to work out how best to approach creating a program in java where I have a very simple GUI where a user can drop in multiple images and multiple text boxes move these around by dragging, resize, maybe a couple of other very simple features and then output a jpg for instance.
I have been looking around and all the program's I can find seem to be much more complex.
I have been trying to do this using java swing just creating a GUI that when you press a JButton inserts a picture into a JLabel, but I'm thinking this kind of thing must be the wrong approach and there must be a better way.
Any ideas and suggestions would be much appreciated...

creating timeline-based editing gui in java

I want to create a timeline-based editing GUI in java - in the style of a video-editing software (such as adobe premiere for example). Below is an image, how I have the GUI in mind (sorry for not including it directly - as a new user that feature is disabled):
Whats currently implemented is just the timeline-slider at the top (with JSlider) - all the rest is just made up with Photoshop (also the black-line that goes down from the slider, through the layers).
Now my question is not very specific, I just wanted to get some input how I could implement the rest as nice as possible. To be a little bit more precise, I would appreciate hints to the following topics very much:
How to organize the whole gui - concerning the time indicator-line
which goes from the top to the bottom through all the layers?
How to visualize the waveform, are there good (and free) packages
that can be used? (audio files are either MP3 or WAV)
Which element to use for the text-segment layers (they should be draggable & droppable somehow) -> JLabels, JButtons, how to best solve the drag-n-drop feature?
You see I have still some work ahead of me, any good advice or point to the right direction would be very kind!
For the waveform issue you could take a look to this question and the accepted answer. The class creates a PNG image file, but you should be able, instead of saving the image, just display it in your programm.
The drag n' drop thing is well explained in this tutorial by Oracle.

How to create something similar to JFileChooser in Java?

I am trying to make a frame similar to a JFileChooser. I have a scrollpane and 2 toggle buttons, one for list view, and other for icons view. I will be using CardLayout on the scrollpane. However, I don't know where to begin. I would like to know a good approach on this matter. How do I design the 2 panels that will be put over the scrollpane?
Something similar is the GroupBox in C# forms.
If you want to create "something similar to JFileChooser" why not to take a look on code of JFileChooser itself? You can find JDK source in file src.zip under your JDK directory.
See File Browser GUI for some tips.
I need to know how to create custom views. For example, for the listView option, I will be able to create a Jlist(i think) that will be spread out horizontally on multiple columns. For iconsView i will have some thumbnails that will be displayed vretically on multiple rows, etc.
For the detail view I'd tend to use a JTable. 'horizontally in multiple columns' can be done using a list and setLayoutOrientation(int).

UI for an intended XSL-FO designer in Java

I intend to write a XSL-FO designer in java for which i need to write an UI. The basic idea is to give the user a work pane wherein he/she can draw rectangles and these rectangles would in turn be associated to field containers in the underlying XSL-FO generator. Once the field container are done, the user should also be able to select any of the rectangles(field containers) created and add components into it. These will in turn be translated into field blocks that fall under the chosen field container.
Till now I have created a simple UI using JFames with mouseListeners hooked to them so that i can have users draw the rectangles on the work area.
Im stuck at the point on how to implement the part where the user selects one of the rectangles created in the previous steps.
Given the intent of the designer, is it possible to accomplish this using Jframes ?
Any pointers/suggestions on how i can achieve the motive of this designer would be of great help !
Please excuse me if any part of this post is noobish. I am one when it comes to UI.
JInternalFrame might be a starting point. You can connect them, as shown here, and add arbitrary components as required.

Categories

Resources