swing

JTabbedPane weird behaviour

I have the following code : JTabbedPane container; ... AWindow page = WinUtils.buildWindow(); boolean existing = checkIfExists(page); // in this code, this will always be false if(!existing) { String tabName = page.getLoadedFileLocation().getName(); container.addTab(page.getLoadedFileLocation().getName(), page); } Component com...

what is the best way to use dates with java swing

what i want to do is having like the java script popup date chooser in my application. i am using java swing and would like to avoid any input mistakes by the user. specifying a format is easy to implement but not user friendly for the user. what are your suggestion ? any libraries? ...

Swing: How to make non-rectangular windows with soft borders?

Hello! How could I make non-rectangular windows with soft borders in Java? Soft borders (also known as soft clipping) are borders without aliasing artifacts. I searched the web a lot and found several posts about translucent and/or non-rectangular windows. The topic "soft border" is confusing. It seems that the information I found dea...

Custom JSpinner

I have created the following class that extends JSpinner to iterate over dd/mm/yyy values. public class DateSpinner extends JSpinner{ Calendar calendar = new GregorianCalendar(); public DateSpinner(){ super(); calendar.add(Calendar.DAY_OF_YEAR, 1); Date now = calendar.getTime(); calendar.add(Calendar.DAY_OF_...

Window z-ordering in java

Is there a way to manage the window z-ordering of JDialog windows within java? I would like to able to assign each window to a layer such that windows on lower layers can never go above and obscure windows on higher layers. Even when they have focus. Similar to the Z-order capability that exists for components but for JDialog windows....

GUI: Changing panels based on value of combo box

Hi, I have a question about GUI design, specifically with Java Swing and creating clean separation between presentation and model. It's a bit difficult to describe, but essentially we have lots of reference data in our system (i.e. that would correspond to lookup tables in the DB). We want people to be able to edit them all from one scr...

Live sorting of JTable

I've figured out how to get a JTable to be sorted properly, but I can't figure out how to get it to automatically update the sort order when a table cell is changed. Right now, I have this (admittedly long) code, mostly based on that in the Java Tutorial's How to Use Tables. I've highlighted the changes I've made with // ADDED. In this ...

Selecting text from a JLabel?

Is it possible to enable the selection of text from a JLabel? If not, what's the best alternative control to use, and how can it be configured to appear like a JLabel? ...

How to do smooth scrolling for lists in Swing

On the iPhone scrolling through lists is animated smoothly. Ignoring the inertia effect (though having it would be cool as well) - how would I go about making a Swing listbox scroll smoothly like that? There are other examples as well, like browsers, but those use native controls which I cannot use with Swing. ...

How can I host a Java Swing component in a .NET application

I have some Java user interface controls that I want to host in my .NET application as I can't afford to rewrite them. How can I do that? Do I need to wrap them up in COM? How do I do that? I want the component to sit on a form with other components written in .NET. ...

What technology to use to write systray front-end to webapp?

Hi, we have an internal webapplication running on tomcat, build on Spring. The webapplication front-end is build with Flex. I would like to create a cross-platform systray application that allows to go the home page of the application and displays alerts when certain things happen in the server. What would you think is the best techno...

JTable TableModel problem in Java

Hi, I can show my data in a JTable without a problem, but when I want to filter while my app is running, the JTable is not showing me data changes. I searched for it and found a class named TableModel but I can't write my AbstractTableModel. Can anyone show me how I can do this? Personelz.Java package deneme.persistence; import java....

Swing tweaks for Mac OS X

I remember having once seen a list of properties that could be set on Swing components to make them look more native on Mac OS X. This included ways to mark "dirty" documents with the "dot" in the window close button, open dialogs as sheets (not sure about that, but sure would be nice) etc. I know Apple has let Java down as a "primary"...

SQL data and JTable

I'm trying one sample program for practice and i want to display results of database in JTable. The problem is i have no idea how to do that. I know how to get data from database and display it on text field or console but never tried with JTable. How to do that ? Consider that i've table which is holding information like person name, ...

Java Swing Timer

ActionListener taskPerformer = new ActionListener() { public void actionPerformed(ActionEvent evt) { //...Perform a task... logger.finest("Reading SMTP Info."); } }; Timer timer = new Timer( 100 , taskPerformer); timer.setRepeats(false); timer.start(); According to the documentation...

How do I show the pound sterling (£) sign in Java Swing?

Currently, I add a pound sterling () sign to the Java source and compile the resulting Swing component shows as the square (unsupported character) symbol. I suspect it's an encoding problem, the Java source file is encoded as cp1252 (Eclipse seems to default to this). What's the correct way of resolving this? ...

How do I get a an image to display in JTable in java swing

I have created a jTable and have put an ImageIcon objects in one of the columns. I would like to know how I can get it to display the image rather than the image name as a string. Thanks ...

How to create a JButton extension with rounded corners?

This is a continuation of the question "Java rounded Swing JButton". I have searched for an extension of javax.swing.JButton which will inherit all runtime behavior and just override drawing of the corners. Using the code given by noah.w on sun forums page the result looks like this: I'd like to be able to have the same gradient in t...

Image not displaying in JTable (Java Swing)

Hi I have created the following code. The problem is the image is not displaying in the JTable column. I extend the DefaultTableModel and override the method getColumnClass. It was suggested this was one way to do it. Any clues? the code is below. //package javaapplication12; import javax.swing.*; public class NewJFrame2 extends...

SwingWorker cancellation with ThreadPoolExecutor

Hi, i am using a ThreadPoolExecutor with a thread pool size of one to sequentially execute swing workers. I got a special case where an event arrives that creates a swing worker that does some client-server communication and after that updates the ui (in the done() method). This works fine when the user fires (clicks on an item) some ev...