swing

NullPointerException in javax.swing.text.SimpleAttributeSet.addAttribute

Has anyone ever seen an exception like this (with version 1.6.0_11 of the JVM)?: ERROR: java.lang.NullPointerException: null at java.util.Hashtable.put(null:-1) at javax.swing.text.SimpleAttributeSet.addAttribute(null:-1) at javax.swing.text.SimpleAttributeSet.addAttributes(null:-1) at javax.swing.text.StyledEditorKit.cr...

Swing: Multiple CellEditors for a column

Hi, In my JTable, I have two editable numeric columns. The editor for both columns extends AbstractCellEditor and uses a JFormattedTextField as an the editing component. The problem is that the format for input depends on the value of another column in the row. If condition X is met, the number of fraction digits should be Y, otherw...

parser the xml and build a ui for user

Hi: Now I have to handle some xml in my java swing application. I have to build a swing ui according to the special schema ,then user can fill some values.After user completed,I will collect the information,validate the value and then build a xml file. For building xml file I can use the xmlbeans,however how to parse the schema and buil...

Is there an easy way to develop with Swing Application Framework (JSR 296) AND Jython?

I'm learning Jython. I developed a simple Swing Application with Jython and it's ok. Now I would to use the Swing Application Framework (JSR 296). I did not find any example in Internet. ...

java swing frame excellent for resultset from database

sir, l want to display resultset in jframe.i get output last record in the database displayed. Lam intrested to place next button,back button in the frame.when i was click in the back button previosly viewed record is displayed and vice-versa.i don't know it will be possible.plz help me ...

Java form from xml

is there a tool to generate a Swing form from xml code? ...

Java Swing MigLayout, centering two elements inside a spanned row

I'm working on a MigLayout form with 3 columns and 4 rows, like this: "wrap 3", "[15%] 15px [45%] 15px [40%]", "20 [] 15 [] 15 [grow,fill] 15 []" Now my goal is to have it look like this: .------------------------------------. | 15% | 45% | 40% | |------------------------------------| | | | ...

Is it possible to have a JPanel over JTable

Hello, I have a JTable whose associated TableModel could be initially empty. Therefore, it currently shows a JTable with its columns and no rows. In order to fill this JTable, I want the user to drag and drop elements from another component. The problem is that I would like to hint the user that he/she should drag elements to this tabl...

Java: getInputMap(WHEN_IN_FOCUSED_WINDOW) from within JInternalFrame

I have a component inside a JInternalFrame which needs to perform actions when keys are pressed within the JInternalFrame's parenting window. Using InputMap/ActionMap would be ideal, but the getInputMap(WHEN_IN_FOCUSED_WINDOW) of the component returns an InputMap that treats the JInternalFrame as the "focused window", rather than its par...

Why keylistener is not working here?

i have implemented keylistener interface and implemented all the needed methods but when i press the key nothing happens here, why? package swing; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Point; import j...

Netbeans GUI building on pre-defined code

I am supposed edit some code for an assignment, and he gave us the framework and wants us to implement code for it. I load the project into netbeans and can't figure out how I'm supposed to edit the swing components. I don't see how to edit source vs. design. import javax.swing.*; import java.util.*; import java.io.*; public class Cu...

Using an empty column as a divider in a JTable.

I'm trying to use an empty column as a divider between pairs of columns in a JTable. Here's a picture and code for what I have so far. I know I can change the look using a custom TableCellRenderer. Before I go down that road, is there a better way to do this? Any ideas appreciated. import javax.swing.*; import javax.swing.table.*; pu...

Jpanel layout problem, show a two column of buttons and labels, how?

i want to make a jPanel ( vehicleListPanel) with two column like this NAME | button name | button ... left column show vehicle name , and right to show an icon proper with vehicle status (red, green icon) ... i try to make it, but there is problems with button size, i can't set it how i want, plz help me with example thanks ...

how to disable the action Ctrl-Alt-Delete through java program

I am creating desktop application using the JDesktopPnae.I complete almost.But when i press ctrl-Alt-Del key it comes out of my application. how can i prevent that action Thanks ...

Alternative to JFileChooser on Linux?

I don't like this ugly FileChooser layout in Linux. This layout is used by any other program and is MUCH more beautiful. Is this layout available in Java? If so, how? ...

Java Graphics2D DrawString....

Hey guys I have a little issue here. I have a panel where I am drawing a string. This is a game so I keep redrawing the score in order to update it. However when I draw it again it is drawn on top of the previous score so it looked all garbled up. Any ideas how to fix this? comp2d.drawString(GetScore(Score),ScoreX,ScoreY); ...

Unable to change background colour for JOptionPane

Hi I have created sample progeam which will give same look and feel of a confirm dialog and set the background colour as red. But I donot know what is the problem that my background colour of option is displayed as the default colour but not red. also i need same look and feel of confirm dialog across all platforms. Here is the code tha...

How to set custom size for cursor in swing?

I am using the below code to set a custom cursor for JPanel, but when i run the code its enlarging the image which i set for cursor. Is there a way to set a userdefined cursor size ? Toolkit toolkit = Toolkit.getDefaultToolkit(); BufferedImage erasor=new BufferedImage(10,10, BufferedImage.TYPE_INT_RGB); Graphics2D g2d=(Graphics2D) eraso...

Javax Swing Timer Help

Hello Guys, I am having some problems concerning starting javax.swing.Timer after a mouse click. I want to start the timer to perform some animation after the user clicks on a button but it is not working. Here are the code snippets: public class ShowMe extends JPanel{ private javax.swing.Timer timer; public ShowMe(){ timer =...

Java Swing: Expanding TreeNode

I am working on customizing a closed source client application. It has a tree in the UI and exposed only a method to get the selected node. It returns a subclass of TreeNode. And there is no way to get a reference to the parent tree. Now i want to expand the selected node upto its leaves. Is there any way to get a reference to the JTree...