swing

How to set the colour of my 1st row in my JTable to yellow(or any colour)?

I am able to set one column to yellow but I am unable to set a row to yellow. The following code does it for the column: TableColumn col = mytable.getColumnModel().getColumn(0); col.setCellRenderer(new MyTableCellRenderer()); How do I do it for a row please? I have tried the tutorials and examples on the net but it always paints th...

How do I detect if a display is in High Contrast mode?

I'm testing my company's established Swing application for accessibility issues. With high contrast mode enabled on my PC certain parts of this application are rendered properly (white-on-black) and some incorrectly (black-on-white). The bits that are correct are the native components (JButton, JLabel and whatnot) and third party compo...

JTabbedPane: Actions performed before displaying selected tab

When one of the panels present in a JTabbedPane is clicked, I need to perform a few actions at the start. Say, for example, I need to check the username and password. Only if those match, the particular panel operations need to be performed. Can you suggest any methods? ...

PaintComponent Takes a Long Time, Ties up the Swing Event Dispatch Thread

I've customized a JPanel that displays a large, complicated diagram. Depending on the size of the data, it can take a few minutes to render in paintComponent(). I'm looking for a strategy to: draw the component without tying up the event dispatch thread. draw something in the JPanel to let the user know the image is being rendered. pe...

Where do I find a good, short, architecture-oriented introduction to Java Swing GUI for web developerrs?

I'm just starting my first Java Swing project(doing mainly web-based apps before) and try to understand how to build a proper architecture with separation of concerns between the MVC components. Just about any documentation I find goes very deep into the details of how each and every Swing UI widget works and can be used, but all exampl...

Setting background images in JFrame

Are any methods available to set an image as background in a JFrame? ...

Knowing when a JFrame is fully drawn

I have a program that creates a JFrame and makes it visible. Is there anyway to know when the JFrame is fully drawn and visible? Right now a hacky "wait and pray" method is being used. Thanks for the help! ...

How to Set the Background Color of a JButton on the Mac OS

Normally with Java Swing you can set the background color of a button with: myJButton.setBackground(Color.RED); which would cause the button to be red. But on the Mac OS, this method seems to be ignored. The button just stays the default color. How can the color of a JButton be set on the Mac OS? ...

Painting rows in a JTable

I have an implementation of a DefaultTableCellRenderer. When someone selects a row in the table, the row gets highlighted green. If I wanted to highlight the row under the one selected what is the easiest way to achieve this? Is this even possible without having to re-render the entire table? So at the moment, I have something that l...

JAVA - Validation in JTable

I am trying to validate a cell in the JTable as soon as the data is entered. I want to make sure that say the correct code is entered in the code column. Could anyone let me know how to do this please? Thanks ...

Problem with Showing Records in Jtable

I am using DefaultTable Model for showing my records in Jtable.But there is a problem like in the picture.When i load jtable its showing like LJava.lang.Object type. NOT in string..How can i solve this. Here is my codes ; EntityManagerFactory emf = Persistence.createEntityManagerFactory("SwingDenemePU"); EntityManager em = emf.createEn...

Automatically connect to a DB in a swing application

Hello, I m working on a single user swing application that access an hsqldb database. How can i Automatically run the DB server when a user run the application.? for example, after i finish development i will put the application into an exe file. If the exe file is distributed to multiple users. How can the DB server run and the DB b...

Stopping default behavior of events in Swing.

I have the following bit of code in a method called by clicking the send button, or pressing enter in the message text field in a piece of code. // In class ChatWindow private void messageTextAreaKeyPressed(java.awt.event.KeyEvent evt) { // Event handler created by Netbeans GUI designer to call this method. if(evt.getKeyC...

Strike through java.awt.Font

Is there a way to make a java.awt.Font strike through? ...

Extensible GUI framework for Java

I'm a fan of swing and find it has done everything I need except for extensible GUIs. I can make small parts extensible programmatically, but if I want to plug in an optional feature it can be quite tedious to dynamically generate every component being altered. The short period I spent writing a Firefox plug in got me very interested i...

Where to look to get started with making an animated clock with Swing in Java?

I am trying to make an animated clock using Swing in Java. The picture I have posted is a basic idea of what I am looking for. In the end I hope to have the arrow be stationary and the numbers move to indicate the hour, plus I want to have a nested circle with 60 boxes doing the same. I'm not looking for code on how to do this just some ...

How to generate a Jlist with alternating colors

In Java how do I get a JList with alternating colors? Any sample code? ...

jComboBox giving org.hibernate.PropertyAccessException error

Hi , There is 2 jComboBox .. and 2 Class . When form load event it will fill jComboBox1,when ActionEvent fired it will load another class with selection of the jComboBox1.I wanna get PersonelID from jComboBox.GetSelectItem method than call another class with this id. But gettin this error ; Exception in thread "AWT-EventQueue-0" javax....

Java sampling pixel color in swing

I have to create a special TextFieldUI that draws an image as the background. That image contains some alpha components. However, whenever a character is written in that text field, first it redraws the background and then draws the character. This is fine when the background contains no alpha components, but after a few characters ha...

How to add icon near arrow icon for JComboBox

Hi all, I would like to create JComboBox control similar with the URL textbox of Firefox. Does anyone know how to customize the textfield of the JComboBox. I want to add some icons on the ALIGN.HORIZONTAL_RIGHT near the arrow button of the JComboBox Thanks, Minh ...