swing

What if a large number of objects are passed to my SwingWorker.process() method?

I just found an interesting situation. Suppose you have some SwingWorker (I've made this one vaguely reminiscent of my own): public class AddressTreeBuildingWorker extends SwingWorker<Void, NodePair> { private DefaultTreeModel model; public AddressTreeBuildingWorker(DefaultTreeModel model) { } @Override protected V...

Can we develop very good looking UI in swing and if not what are alternatives

Hello In my current project we have to develop a good looking desktop based application in java. Currently, we have a very basic desktop application written in swing and team does not have good swing knowledge. Can we create a very good looking UI in swing? Should we use JavaFX for creating the desktop application? What are other a...

Can not load the images in Java Swing when running from a .jar-file

I can run my Java Swing application from Eclipse without problems. But when I run it from a .jar-file, the images fails to load. I load my images with: setIconImage(Toolkit.getDefaultToolkit(). getImage(getClass().getResource("../images/logo.png"))); How can I load the images so they work even when I'm running from a .jar-file? The ...

Shining progressbar in java swing application

Can anyone have shining progressbar component for java swing application? ...

Encrypt jar executable internally in java swing application

How to encrypt jar executable internally made in java swing application? [It must be executable without decrypting it.] ...

How do you get the selected character position in a JTextArea?

Hi! Here is a challenging question! Let me first tell you my scenario how am i implementing a solution to a problem. I am reading a log file and displaying it on the JTextArea. Log file is cp037 character coded. I was reading each file as a byte stream or byte array from the log file & displaying it. Anyways, i managed to display the t...

Prevent to close Java swing Application

How to prevent to close Java swing Application, when user clicks on close button? ...

Cancel changes in a Java Swing Input window

I am new to Java Swing and I am creating a window which displays a list of items retrieved from an XML file that can be manipulated by the user. The window should have a Cancel and a Save functionality implemented with buttons. While the Save functionality is straightforward (just close the window) I don't know how to implement the Canc...

How to right-justify icon in a JLabel?

For a JLabel with icon, if you setHorizontalTextPosition(SwingConstants.LEADING), the icon is painted right after text, no matter how wide the label is. This is particularly bad for a list, as the icons would be all over the place depending on how long the text is for each item. I traced the code and it seems to be that in SwingUtiliti...

Open source laf[look n feel] for java swing application

Which are Open source lafs[look n feel] for java swing application? ...

change all the label icon in a panel (solved)

I have a panel with several JLabel, I would like to change all their Icon, String path = System.getProperty("user.dir"); for (int x=0;x< 21;x++) { javax.swing.JLabel lab = boardPanel.getComponent(x).; lab.setIcon(new ImageIcon(path + "\\image\\blank.jpg")); } it gives me an error of incompatible type, all inside the boardPa...

JTable listener problem

I added a mouse clicked listner to my jtable, when i double click the row, will pop up an window accordingly. jTable.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent e) { double amount = Double.parseDouble(jTable.getValueAt(getSelectedRow(), 4).toString()); String remarks = jTable.g...

JTable Insert row and refresh

Hi All, I am trying to create simple application where JTable gets updated and refreshed after data is changed.Structure is as follows. 1)Class Main which contains JFrame,JTable details. 2)SampleTableModel class which extends AbstractTableModel.I am overriding most of the methods. import javax.swing.table.*; import java.util.*; public...

swing syntax highlighter

Hi, I need some advice on creating a syntax highligher for java application using swing. The application should allow to edit a file and highlight syntax. I don't know the swing library, what should I look for? ...

Writing something in JList

hey i have another problem. I created JList in my main window and now i want to add something to it. I do it this way... private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { Dodaj_Przedmiot dodaj_przedmiot = new Dodaj_Przedmiot(null, true); dodaj_przedmiot.setVisible(true); ...

How to check whether the tab is active or not in JTabbedPane?

Hi, How to check whether a tab in JTabbedPane instance is active or not, in the class of the tab(nested class) itself and not in the enclosing class? I know that there is a method 'booloean isEnabledAt(int index)'; but this method can only be called in the enclosing class whereas I want to check whether the tab is currently selected ...

Java - How to set focus the already running application ?

I am using a ServerSocket port to run one instance only of my Java Swing application, so if a user tries to open another instance of the program, i show him a warning that "Another instance is already open". This works fine, but instead of showing this message i want to set focus on the running application itself, like some programs does...

create TableModel and populate jTable dynamically

Hi all! I want to store the results of reading lucene index into jTable, so that I can make it sortable by different columns. From index I am reading terms with different measures of their frequencies. Table columns are these : [string term][int absFrequency][int docFrequency][double invFrequency] So i in AbstractTableModel I can defi...

Java:How to align JPanels

I have this code but it doesn't work: jPanel1.add(jLabel1); jPanel2.add(jButton1); jPanel2.add(jButton2); jPanel3.add(jPanel1,jPanel1.TOP_ALIGNMENT); jPanel3.add(jPanel2,jPanel2.BOTTOM_ALIGNMENT); setContentPane(jPanel3); pack(); Please tell me why! ...

How to get value from 1st panel and insert in 2nd panel in Java Swing

Hi. I had employ name Text Field in 1st panel in D module. when i click generate button the employ name automatically update in display panel Employe Name Textfield in E module. so in both the panels the value must be same. how can i get the value from D module and update in E module by using Java Swing. ...