swing

Rich calendar component for Swing application

My company is adding some rich calendar functionality to our Swing application. We want it to work like Outlook's calendar. Here are some of our requirments: Views for day, week, and month The ability to specify calendar items down to the minute level The ability to drag and drop calendar elements into different slots Editing of cale...

Any way to force jidetabbedpane to show always the first tab

Hello, i have the requirement that i have to display a tabbedpane, but the first tab has to be static. So i tried to use the jidetabbedpane, since it cares about the effect, that all the tabs are listed in a box, it is navigable, it can show the desired close operation and so on. But the only thing i am missing is the option: set first ...

Image panel not repainted unless on system events

A friend of mine asked me to help him with Swing, and I reached a point where I can't solve an issue. So, first I have an ImagePanel public class ImagePanel extends JPanel { private Image img; public void setImage(String img) { setImage(new ImageIcon(img).getImage()); } public void setImage(Image img) { int width = t...

SpringLayout problem/challenge

SpringLayout is claimed to be very powerful. I tried to implement what I thought was a fairly simple layout using SpringLayout and I'm failing badly. Reduced to the minimum, I want 4 JButtons on my JFrame, side by side: *=====================* | +--+ +--+ +--+ +--+ | | |b1| |b2| |b3| |b4| | | +--+ +--+ +--+ +--+ | *====================...

How to have program wait for a button press in Java.

Now, I'm not sure if this is possible or even the best way to accomplish what I'm trying to do, but basically I'm creating a very simple simulation program with a very simple Swing GUI. After each round of the simulation, some buttons on the interface are enabled for the user to make changes and then the user can press the "continue" b...

Which Swing layout(s) do you recommend?

There are 8 layout managers in the Java library alone, and then there's a bunch of 3rd party products as well. The other day, I tried to use SpringLayout and... well, it ain't working out for me. See my other question. So... if you have a Swing app to design, and you want your layout just so, what are your preferred layout managers? Any...

Accessing a JTextArea in a JScrollPane.

Hi, I have a JTextArea in (multiple) JScrollPane in a JTabbedPane. I need to access the JTextArea. If I didn't have the JScrollPane, I could do: JTextArea c = (JTextArea)jTabbedPane1.getComponentAt(i); How would I get it when in a JScrollPane? Cheers, Gazler. ...

How to display current active cell outline while using Substance L&F?

Hi Everyone, I created a JTable with the Substance LAF (SubstanceBusinessBlackSteelLookAndFeel). My problem is that it is not displaying the outline on the currently focussed cell. Is this a bug with Substance LAF or do I need to set some properties? I tried with basic Metal LAF and it is displaying the outline for the current active c...

How to draw circle on JPanel? Java 2D

I have a JPanel for which I set some image as the background. I need to draw a bunch of circles on top of the image. Now the circles will be positioned based on some coordinate x,y, and the size will be based on some integer size. This is what I have as my class. import java.awt.Dimension; import java.awt.Graphics; import java.awt.Imag...

GridBagLayout .NET WinForms

Is there anything similar to Java Swing's GridBagLayout on .NET and Winforms? ...

Two Applets in same page

I am trying to put two applets which share same code base but initialized with different paramaters in same web page. process goes like this: applet.jar->create two applet tags, with different parameters, same jar in a page->deploy to server->access the page. HTML looks like this: <HTML> <HEAD> <TITLE>Java applet example - Passing a...

Howto make JButton with simple flat style?

Hi, whats the most simple way to make a JButton only show the background color? I don't need any other effects like borders, 3D-look or hover-highlighting. Thanks in advance. ...

How to add default item like Add New Item at top of JComboBox

How can I add a default entry at the top of a JComboBox such as Add New Item in order to allow a user to click this entry and get a dialog allowing them to create a new entry? Should I try to use a custom renderer or what is the best approach? I appreciate anyone's assistance with this. ...

Java: Linebreaks in JLabels?

I'm trying to make a Swing JLabel with multiple lines of text. It's added just fine, but the line breaks don't come through. How do I do this? Alternatively, can I just specify a maximum width for a JLabel and know that the text would wrap, like in a div? private void addLegend() { JPanel comparisonPanel = getComparisonPanel();...

JEditorPane can't take Google search queries, why?

Hi, I am creating a very basic web browser using JEditorPane just to teach myself Swing and GUIs in Java but am having trouble implementing a Firefox-like Google Search bar. I'm not if it's due to a limitation of JEditorPane or my lack of understanding but if I try and take the string typed into the "Google Search" bar and use the setP...

Why does InvokeLater cause my JFrame not to display correctly?

Ok I've read an searched all over the web, and I've not found the solution to my problem yet, perhaps I'm missing something simple, hence here I am... I've got a rather large project, that handles work orders for a repair business. It's all database connected, many many pages of code, and classes. But i just added a short bit of code to...

Can't not use ListCellRenderer

I'm using Netbeans to develop my Java application.I want to display list of items with icons. I have use ListCellRenderer but it just display item, but not icon. Here is my code //Item class public class Item { private String title; private String imagePath; private ImageIcon image; //getter and setter} //ItemRenderer publ...

Is it OK to change a model outside the Swing worker thread?

In a "serious" Java GUI app, you'll have models behind many of your GUI elements: A DocumentModel backing a JEditorPane, for example, or a ListModel behind a JList. We're always told not to make GUI changes from outside the Swing worker thread and given SwingUtilities.invoke...() for working around that. Fine, I can live with that! It's...

Can I change the root directory of the session storage?

Currently the session storage saves all session files in a system dependand folder suited for session state files. But in one of my applications I want the session files be saved in a special directory. Can I change the root directory of the session storage? ...

Have setMnemonic underline a character other than the first occurrence

In a re-implementation of an existing program, I would like to keep the message text that users are familiar with. One of the enhancements I'd like to add is a good keyboard-only interface including mnemonics. But using the intuitive mnemonic character with the existing text gives some ugly results. For example: useUpperCheckBox = n...