Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I highly recommend taking <a href="http://www.glazedlists.com/" rel="nofollow">Glazed List</a> into account.</p> <p>It's a library which takes care of the most of the heavylifting related to presenting tabular data in a table with both filtering and sorting. It also provides a multithreading-safe datamodel. Using bare Swing and Java it's a lot lot harder to implement it all correctly. </p> <p><a href="http://www.glazedlists.com/documentation/tutorial-100" rel="nofollow">Here</a> is a nice tutorial provided. Once anybody starts writing CRUD GUIs, sooner or later all end up wanting so called "standard features" which all table oriented guis share in common. Why wasting time inventing it all and risking making a lot of mistakes, when you can build upon proven solutions. Especially, when it's so easy.</p> <p>An example, displaying a XML based JTable:</p> <pre><code>import java.util.*; import java.io.*; import javax.swing.*; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import java.awt.Insets; // a simple issues library import ca.odell.issuezilla.*; // glazed lists import ca.odell.glazedlists.*; import ca.odell.glazedlists.swing.*; /** * An IssueBrowser is a program for finding and viewing issues. * * @author &lt;href="mailto:jesse@odel.on.ca"&gt;Jesse Wilson&lt;/a&gt; */ public class IssuesBrowser { /** event list that hosts the issues */ private EventList issuesEventList = new BasicEventList(); /** * Create an IssueBrowser for the specified issues. */ public IssuesBrowser(Collection issues) { issuesEventList.addAll(issues); } /** * Display a frame for browsing issues. */ public void display() { // create a panel with a table JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); EventListModel issuesListModel = new EventListModel(issuesEventList); JList issuesJList = new JList(issuesListModel); JScrollPane issuesListScrollPane = new JScrollPane(issuesJList); panel.add(issuesListScrollPane, new GridBagConstraints(...)); // create a frame with that panel JFrame frame = new JFrame("Issues"); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setSize(540, 380); frame.getContentPane().add(panel); frame.show(); } /** * Launch the IssuesBrowser from the commandline. */ public static void main(String[] args) { if(args.length != 1) { System.out.println("Usage: IssuesBrowser &lt;file&gt;"); return; } // load some issues Collection issues = null; try { IssuezillaXMLParser parser = new IssuezillaXMLParser(); InputStream issuesInStream = new FileInputStream(args[0]); issues = parser.loadIssues(issuesInStream, null); issuesInStream.close(); } catch(IOException e) { e.printStackTrace(); return; } // create the browser IssuesBrowser browser = new IssuesBrowser(issues); browser.display(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload