jlist

JList data addition for IF statements

I know this is kind of a beginners question but my books aren't explaining it and the API isn't helping much when I don't understand it. Someone please help me to get this. I created a JList using NetBeans and everything is set to whatever NetBeans has as a default for JLists. My goal is to make a JList show a List of [x] if a user pic...

JCheckBox to display and perform functionality in JList

I am trying to get a JCheckBox to display on a line that is in the multiple select JList and still perform its functionality. Right now if I add the JCheckBox as an element it just prints its toString format. Help/ideas? ...

Java Swing: Autoscrolling using JList and JScrollPane

Hello community! I'm having this problem: I have a JList (within a JScrollPane) with say about 1000 elements, and the dimensions of this JList obviously doesn't allow to show all the data. Now, I have this JList within a JScrollPane and I need that when I say JList.setSelectedIndex(), the JScrollPane automatically scrolls into, and show...

How to make a scrollable JList to add details got from a JOptionPane

Hi there, I want to repeatedly take input from the user(probably using a button) via a JOptionPane(already done) and store the details in something(how about a dynamic object array) and display this information as a list in a scrollable JList. MY CODE import java.awt.GridLayout; import javax.swing.*; class Flight { public stati...

How to make the jList selectable inside a jTable.

How to make the jList selectable and jScrollPane scrollable inside a jTable. This is my table code : private JTable getCalendarTable() { if (calendarTable == null) { calendarTable = new JTable() { public boolean isCellEditable(int nRow, int nCol) { if (nRow % 2 != 0) { return ...

Java Null Pointer Exception on JLIST

OK so I'm trying to output the current string from an array that was put into a list... However when I click on the list I get a NullPointerException... :\ Help? :) import java.applet.Applet; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class lisTry extends JApplet implements MouseListener { public static...

java refreshing an array into jList

OK so I have a JList and the content is provided with an array. I know how to add elements to an array but I want to know how to refresh a JList... or is it even possible? I tried Google. :\ import java.applet.Applet; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class bs extends JApplet implements MouseList...

Java ArrayLists into JList

OK so I'm doing a small part of my inventory. I got MOST of it down. I'm trying to add string items to an ArrayList then add that to a JList. However, I'm getting this error when I compile: C:\Users\Dan\Documents\DanJavaGen\inventory.java:30: cannot find symbol symbol : constructor JList(java.util.ArrayList<java.lang.String>) location:...

Java JList not appearing

On every JList I've made... I've had to CLICK on it before ANY of the JList would show up. It was like... invisible but still there... UNTIL I clicked on it... I have tried list.setVisible(true) and such... but no luck. :\ Help? Yes, I tried the Javadoc, Google, AND SO Search. >_< I have never encountered a problem like this. Code: i...

JList clearSelection() issue

hello, I have a problem with my two JList components. I created and placed on JFrame two JList components. I added listSelectionListeners to both of them that should unselect a selection of the other JList like so: (edit: To make as requested self-contained sample) public class JListIssue { public static void main(String[] args...

Showing JList in an Applet

OK so whenever I open up a new appelt window with my code... the JList does not show UNTIL I click on it... how do i make it so all values appear when i start the applet? thanks. import java.awt.*; import javax.swing.*; import javax.swing.JList; import java.awt.event.*; import java.util.*; public class inventory extends JApplet implem...

Very slow JList repopulation

I have a JList component which should be emptied and repopulated. The following code (based on my original code) shows a simple window with a JList and a JButton: import java.awt.BorderLayout; import javax.swing.*; public class JListTest extends javax.swing.JFrame{ JList jList; JButton button; DefaultListModel model; ...

save/restore Java swing JList Element to/from MySQL

I'm new to Java (and swing) and looking for a way to save (and reload it later) all JList elements to Database or in particular MySQL. I read about Java Serializable and cannot find a working code for reference. ...

Need to set a double value depending on which item(s) are selected from a JList.

My code so far: import java.awt.BorderLayout; import java.awt.Container; import javax.swing.Box; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JScrollPane; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class TestFile2 { publi...

valueChanged in ListSelectionListener not working

I have created the following class implementing a ListSelectionListener interface. This class should "listen" to the selection events of a JList I have created. Everytime the use clicks on a row of this list, the selected_row value should be updated and the string "The format row selected is ...." should therefore change. However after c...

Java: Jswing: Jlist

When i input a name to the Jlist, the name gets outputted to the lower section of the list, how do i make it to where the name is set to the top of the window package Gui; //import java.awt.BorderLayout; import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public...

Super simple java swing jlist question that I just can't figure out!

Ok, so I am working on a homework assignment, and I am using SWING to make a GUI for a Java project, and I am running into troubles with JList. I have a customer object that I have made and set attributes to, and I want to add the object into a TreeMap. I want to hook up the Treemap so that any and all objects that are in the map will p...

Problem in valueChanged method from the ListSelectionListener interface

I have created a JDialog with three JList lists. The selection of a row in the first list (named FirstList) updates the content of the second list (SecondList) and the selection of a row in the second list updates the content of the third list (ThirdList). In the ThirdList class I have included the following method: public void addRowsS...

JList with custom cell renderer vs Jtable

My current application uses a JList and everything is well (the only customization I did was to set the italic font on some of the rows). Now I want to "upgrade" the user interface and instead of just labels in the List, I want a checkbox and a text field to be able to update the entry. I started changing the code and adding a custom c...