I have a JTable and I need to be able to reorder the columns. However I want the first column to not be able to be re-ordered. I used the following to enable reordering:
table.getTableHeader().setReorderingAllowed(true);
The columns can now be reordered including the first column which I don't want. Is there any way to lock the first ...
I have created a JTable in one class now i need to use the same table, to set some value in it, in a different class. how shall i use the same JTable in that different class. please tell.
...
I have this JTextPane (wrapped in a JScrollPane) that is backed by a HTMLEditorKit. The contents of the JTextPane is simple HTML with some images (local files) embedded using img tags. The problem is that when you load the the JTextPane, it takes a split second to load and then it comes up with the scroll bar at the bottom of the page. I...
I have a JLabel that I need to draw off screen with some Transforms applied to the Graphics object.
I'm trying to make the JLabel as small as it can be without ellipsis depending on its text content.
What I'm trying to do is:
setBounds(0, 0, label.getMinimumSize().width, label.getMinimumSize().height);
Sometimes, this yields ellipsi...
I'm experiencing some strange behaviour when using a stylus with swing.
I am interpreting pressing the button on the side of the stylus(RIGHT) and pressing the stylus down(LEFT) as a "Grab" event, but occasionally (more often than 0), events are just being dropped.
The JavaDocs for MouseEvent are pretty explicit about how multibutton p...
I have a small Java desktop app that uses Swing. There is a data entry dialog with some input fields of different types (JTextField, JComboBox, JSpinner, JFormattedTextField). When I activate the JFormattedTextFields either by tabbing through the form or by clicking it with the mouse, I would like it to select all the text that it curren...
I have a Java Swing UI that isn't updating/repainting as I thought it should. The app sends an XMPP message and receives a response on a different thread. That response is processed and the UI is updated to reflect information contained in the message.
When the response is received, I update a JPanel component using
javax.swing.Swing...
I seem to be having problems with my java gui code, and I have no idea why it's not working.
What needs to happen is when the mouse is clicked on the panel or frame - for now lets just say panel; as this is just a test eventually this code will be implemented for another gui component, but I'd like to get this working first - the popup ...
I'm currently trying to solve a problem where I need to find the position in a piece of text in a JEditorPane based on where the mouse was clicked.
Basically, when the user right-clicks over a word I need to find out what the word is. To do this I need to find out which position in the text the user has clicked on. I know I can easily ...
I have a JFrame that has a large number of changing child components. (Many layers) Is there any way to add a listener for all mouse events? Something like KeyEventDispatcher?
...
I've found several pages and SO answers about the enter-as-tab problem in Java, but all propose either overriding methods of JTextField or adding a key listener to every component.
But isn't there any other way? Can't I override something of the LookAndFeel or install some global policy?
...
i have a Jframe with 2 textfields in it. now i want to make that frame a modal window, how can i do that please tell.
...
In my swing application, I have different types of text I'd like to display. For example, I want to display a heading text before a list of choices, something like:
Select choice:
a
b
I want the "Select Choice" label to use the "Heading" font (something I define), and the choices to use the "Choice" font. This pattern w...
I'm trying to set tooltips on a JEditorPane. The problem is that the method which I use to determine what tooltip text to show is fairly CPU intensive - and so I would like to only show it after the mouse has stopped for a short amount of time - say 1 second.
I know I can use :- ToolTipManager.sharedInstance().setInitialDelay() however ...
BasicTreeUI (in JDK 1.5) handles key events on JTree by navigating to an item on the tree that starts with that letter. What is the most straight forward way to turn that behavior off?
...
I've been writing Java web (JSF, Struts, JSR168) apps for a number of years. With the recent departure of a colleague, it looks like I'm going to be building more client applications. I've used Eclipse since the beginning and I'm really comfortable with it. It feels as though SWT is waning (just an opinion based on literature I can fi...
My TableModel implementations typically sit on an ArrayList to allow for efficient random access performance. However, ArrayList's remove(int) implementation looks fairly inefficient as it involves making a System.arrayCopy(...) call to shift all subsequent elements back by 1.
What approaches to people take to implementing TableModels?...
I had been using the traditional Java TableCellRenderer approach for providing the renderers in a scala.swing.Table where I declare my renderers on the table's TableColumnModel. The code for this looked like:
val myTable = new Table {
lazy val tcm = initColumnModel
peer.setColumnModel(tcm)
override
protected def rendererCompon...
I have a little JWindow with a logo on it that users can drag stuff to.
I develop my application mainly on OS X. To get a transparent window i use
setBackground(new Color(0,0,0,0));
On a mac this works beautifully but i can't get the same effect on windows.
Is there any way to get a transparent window without using 1.6 specific featur...