I'm currently working on making my Swing application look better. I want to achieve something along these lines:
The idea is for each box to have a pretty header with a background similar to the above image. The closest I can get to anything like this using basic Swing components is adding a TitledBorder but this is nothing close to w...
In Swing,
what's the best way to make the JSplitPane to split two jpanels with 50% size each.
It looks like if I don't set preferred sizes on the panels it always makes the first panel almost invisible (2%) and the second one (98%)
Thanks in advance
...
A lot of web sites these days have an option to let the user increase or decrease the size of the font that appears on the site. I'd like to add similar functionality to my Java Swing app, with an option to change the font to either a larger size or revert to standard size. The user would be able to do this at runtime, via a menu item....
While I was using Delphi I remember simple WebBrowser object that used IE and was really easy to use. Is there an option to embed IE in Swing application? I'm not looking for new implementation of web browser (i found some rather expensive ones on web), but just the free option of embedding IE or some other browser in application.
...
I have a created a following renderer which renders the JTree with checkboxes and I want to add different color and icon to different nodes. How do I do it? Please help me. Thank you in advance.
class CheckTreeCellRenderer extends JPanel implements TreeCellRenderer {
private CheckTreeSelectionModel selectionModel;
private TreeCellRender...
I'm scratching my head over this one. Below is a running sample. I have 2 Swing Lists in a flow layout each with a simple data model. Depending on how I instantiate the FlowLayout the 2nd List does not display its elements. Weird.
import javax.swing.*;
import java.awt.*;
public class ListboxTest2 {
public static void main(Stri...
I have a question. When I'm setting the size of a JFrame and I add a new dimension. Is that number millimeter or pixels? I want to set the size to 3in by 3in. So I'm using (300, 300) but it seems a little big. How do I set the size in inches?
Cool this is how I solved it in case someone wants to know:
// Get a Toolkit instance.
Toolki...
Hi,
I need to dynamically draw (star) topologies in a Java GUI application. By star topology, I mean something like this:
It doesn't need to be over-fancy, but I don't want to do it too ugly and crude. By dynamically I mean that the topology changes infrequently over time, but as the number of nodes is very small, a complete repaint ...
I am creating a Blackjack Card game emulator. I am a SCJP,familiar with Core Java concepts. I have a very basic understanding of Java swings and awt.
Already finished writing the basic game logic,a CLI logic. My design includes several classes like,
Dealer,Player,Table,Card,Casino and some others..
Enums for Cards and suite.
I have read...
Java on Mac OS X
In a Swing GUI app I want to distinguish Application Quit from System Shutdown.
On Application Quit I want to show a confirmation dialog, but when the user chooses System Shutdown I simply want to quit the app since there was already a confirmation dialog from the system.
This might be of interest on other platforms...
I have the following code to instantiate a JTable: the table comes up with the right number of rows and columns, but there is no sign of the titles atop the columns.
public Panel1()
{
int nmbrRows;
setLayout(null);
setBackground(Color.magenta);
Vector colHdrs;
//create column headers
colHdrs = new Vector(10);
...
I'm trying to make a Frame from which I want to add an image from a website.
Do I set the background as an image?
import java.awt.*;
import java.net.*;
class NewFrame extends Frame {
// Constructor.
public NewFrame (int width, int height)
{
// Set the title and other frame parameters.
this.setTitle ("Exercise 9.5");
...
I am trying to display an image on a Frame, however the image doesn't fit exactly on the frame. How can I resize the image? I cannot resize the frame. I need it to stay the same size all the time.
// Override paint():
public void paint (Graphics g)
{
Dimension dimension = this.getSize();
Insets I = this.getInsets();
...
I am new to Java and NetBeans but have experience in C/C++. I will be working on an application which will have an area to display an image. The image will be created in memory as an array of unsigned bytes and considered to be monochrome.
I'm looking for a tutorial or examples of displaying data like this as an image. (The data wi...
My Java Swing application generates html file and I want to open it with default browser when it is generated and saved. How to achieve that?
...
Hi, this title may not best describe my problem. I'm using Netbean GUI builder to create a JFrame and several JPanels. I create each JPanel in a seperate class, then I drag the JPanel class to JFrame. The problem is after dragging the JPanel to JFrame, if I add components to JPanel, it does not show the additional components in the JPane...
In my project I've got a JPanel (bottomPanel) in a JFrame that needs to be swapped so I'm using a CardLayout on bottomPanel.
In my parent JFrame I've essentially got this code in a method (setBottomPanel):
bottom.add(p.toString(),p);
bottomLayout.show(bottom, p.toString());
And I call it once in the parent JFrame's constructor and it...
How can I change the icon of nodes and root in the JTree component of Swing?
...
Hi everyone, I'm looking for a highly efficient Swing Java component which I can just plug into my application UI. I already tried using the classes within Swing such as JTextArea with no avail; they simply aren't high-performance enough and have any crippling drawbacks. Additionally, it'd be nice if it had standard console features such...
I am trying to create an image of one of my JPanels at a fixed resolution, or at a resolution that may be bigger than the current screen resolution. Consequently I cannot use a simple screen capture method as it causes my image resolution to be dependent on the resolution of the screen, which the user sets. Is there a way around this?
A...