swing

Why Java Jbutton is not calling JFileChooser correctly?

The following code was generated automatically by Netbeans 6.8 Mac version public class fileBrowser extends javax.swing.JPanel { /** Creates new form fileBrowser */ public fileBrowser() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The co...

JTextArea and JTextField internal padding on text

I would like to increase the spacing / padding / insets for the JTextField and JTextArea. Effectively increase the spacing between the two read line on the image ...

JTextField DocumentListener/DocumentEvent

Hello all, i would like to know how to use a DocumentListener/DocumentEvent in java to prevent the user from deleting a certain portion of text in a JTextField, like on the windows command prompt or unix Terminal.. they show the current working directory and you can't delete past the > or $ can anyone help me? thanks ...

Event Handling in Java

Dear All, How to capture scroll bar event in java. ...

How do i get vertical scrolling to JPanel??

Hello , I have written a code in java using swing.So that i will have a JscrollPane added to JPanel n then I will add buttons of fixed size to JPanel in verticle fashion JPanel panel=new JPanel(); panel.setBackground(Color.WHITE); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS; int h=ScrollPaneConstants.HORIZONT...

how to set size and bound of button which are added on JPanel???

Hello , I have written a code in java using swing.So that i will have a JscrollPane added to JPanel n then I will add buttons of fixed size to JPanel in verticle fashion JPanel panel=new JPanel(); panel.setBackground(Color.WHITE); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_A...

update text field after certain interval

I am updating text field after certain time. Here is my code: ActionListener task = new ActionListener() { public void actionPerformed(ActionEvent e) { try { tip1.setText(ad1.tip1()); tip2.setText(ad1.tip2()); tip3.setText(ad1.tip3()); } ca...

How to add a dropdownbox in paricular cell in JTable, something like microsoft excel?

How to add a dropdownbox in paricular cell in JTable, something like microsoft excel? ...

How to add marquee behaviour to JLabel

How to add marquee behaviour to text of JLabel? I have tried this JLabel search = new JLabel("<html><marquee>Search</marquee><html>"); but its not working. ...

Points not being properly read by MouseListener

Hi, I'm having a problem where I can't properly access my instance Point data. I create an multi-dimensional array of GridPanels, and instantiate each with a Point. When first created, everything works as expected. When I click on a GridPanel however, the Listener class always receives the Point from the last GridPanel that was creat...

Java Swing - Problem with inseting component(JTextArea) in JTextPane

I want to add multiple new JTextArea in JTextPane at runtime on button click. For that i have set Box layout for my JTextPane and i add new component in that using mytextpane.add() method. but it is getting resized and repositioned depending on layout and does not retain the original size of it which i had assigned. Also as i add more co...

how to display running commentary of cmd in textarea designed on gui application using swing in java

After running one executable file from my gui application using swing in java, i want to display running commentary of cmd in my textarea which i have taken on my gui applcation in lower half portion .How can i do it . This is my code i have written for my Run button for running .exe file:- private void runActionPerformed(java.awt.event...

Java Swing - problem insert component in JTextPane

The below given program insert a new JTextArea on button click. Everytime new TextArea is inserted in new Line. The program is working fine on Linux machine but not on windows machine. On windows machine it is giving me BadLocationException . Can anyone please tell me the solution of this problem. Thanks in advance. import javax.swing.J...

With Swing & Java, what is done by the "Swing-Shell" thread

Hi, with threads & swing, the event queue (event dispatch thread) is broadly presented & discussed. However, when examining the thread states with a Swing application, there's also a thread named Swing-Shell. With brief googling I couldn't find much details, mostly thread stack traces with bug reports etc. Can somebody describe shortl...

Adjust size and colour of JTable-grid and make cells resizable

How to adjust the size and colour of grid in JTable and how to set JTable so that length of column or row can be increased and decreased by dragging it? ...

JFrame close question

Hello guys, Say If i have two classes, in each class is a different JFrame, e.g JFrame A and JFrame B ( in seperate classes). Now from the constructor of JFrame A I may push a button with an actionlistener attached, which will instantiate the other class, thus creating JFrame B. The problem is when JFrame B is created, both the JFrames ...

Java Swing long Thread execution

Hi folks, I have written a framework that does calculations that take a long time to execute (about 15 minutes). I now want to write an interface in Swing which will gather the data from the database and execute this calculations. I just wondered now how to do that best practice? If I do time intensive computations in the event thread ...

How to set header for JTable?

String column_names[]= {"Serial Number","Medicine Name","Dose","Frequency"}; table_model=new DefaultTableModel(column_names,3); table=new JTable(table_model); We want to set header with names of columns as in column_names with the above code but it is not working. Header is not visible though table is getting created. ...

JCheckBox added in a JTable cell is not visible

I have added a JCheckBox in a cell of a JTable. But when the frame containing the JTable loads i can not see the JCheckBox in the JTable. Instead of the component it shows true/false values of the JCheckBox when i click on that cell. checkbox_column=table.getColumnModel().getColumn(4); checkbox_column.setCellEditor(new DefaultCellEditor...

Self-contained JNLP launcher + data file

I've got a JNLP editor application that saves data to data files. I'd like to allow users to send self-container viewer applications+data in a single file. Ideally, this self-contained file would be a double-clickable .jar file containing the data file and anything needed to bootstrap the JNLP application. Do you have a recommendation ...