{"id":27188,"date":"2021-05-13T23:10:06","date_gmt":"2021-05-14T03:10:06","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/jlist-examples-programming-code-examples-java-j2ee-j2me-advanced-swing\/"},"modified":"2021-05-13T23:10:06","modified_gmt":"2021-05-14T03:10:06","slug":"jlist-examples-programming-code-examples-java-j2ee-j2me-advanced-swing","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=27188","title":{"rendered":"JList Examples #Programming Code Examples #Java\/J2EE\/J2ME #Advanced Swing"},"content":{"rendered":"<pre>\nAll examples, except for FileTransfer use WindowUtilities.java and ExitListener.java.\nWindowUtilities.java: \nimport javax.swing.*;\nimport java.awt.*;   \/\/ For Color and Container classes.\n\n\/** A few utilities that simplify using windows in Swing. \n *\n  *\/\n\npublic class WindowUtilities {\n\n  \/** Tell system to use native look and feel, as in previous\n   *  releases. Metal (Java) LAF is the default otherwise.\n   *\/\n\n  public static void setNativeLookAndFeel() {\n    try {\n     UIManager.setLookAndFeel(\n       UIManager.getSystemLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting native LAF: &quot; + e);\n    }\n  }\n\n  public static void setJavaLookAndFeel() {\n    try {\n     UIManager.setLookAndFeel(\n       UIManager.getCrossPlatformLookAndFeelClassName());\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Java LAF: &quot; + e);\n    }\n  }\n\n   public static void setMotifLookAndFeel() {\n    try {\n      UIManager.setLookAndFeel(\n        &quot;com.sun.java.swing.plaf.motif.MotifLookAndFeel&quot;);\n    } catch(Exception e) {\n      System.out.println(&quot;Error setting Motif LAF: &quot; + e);\n    }\n  }\n\n  \/** A simplified way to see a JPanel or other Container. Pops\n   *  up a JFrame with specified Container as the content pane.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title,\n                                    Color bgColor) {\n    JFrame frame = new JFrame(title);\n    frame.setBackground(bgColor);\n    content.setBackground(bgColor);\n    frame.setSize(width, height);\n    frame.setContentPane(content);\n    frame.addWindowListener(new ExitListener());\n    frame.setVisible(true);\n    return(frame);\n  }\n\n  \/** Uses Color.white as the background color. *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height,\n                                    String title) {\n    return(openInJFrame(content, width, height,\n                        title, Color.white));\n  }\n\n  \/** Uses Color.white as the background color, and the\n   *  name of the Container's class as the JFrame title.\n   *\/\n\n  public static JFrame openInJFrame(Container content,\n                                    int width,\n                                    int height) {\n    return(openInJFrame(content, width, height,\n                        content.getClass().getName(),\n                        Color.white));\n  }\n}\n**\/\/\nExitListener.java.:\nimport java.awt.*;\nimport java.awt.event.*;\n\n\/** A listener that you attach to the top-level JFrame of\n *  your application, so that quitting the frame exits the \n *  application.\n *\n  *\/\npublic class ExitListener extends WindowAdapter {\n  public void windowClosing(WindowEvent event) {\n    System.exit(0);\n  }\n}\n**\/\/\nJList Examples\n\n    * JListSimpleExample.java Illustrates creating a simple list. In this example, all the entries for the list are stored in a String array and later supplied in the JList constructor. In addition, a private class, ValueReporter, implements a ListSelectionListener to display the last entry in the list selected by the user. \nimport java.awt.*;\nimport javax.swing.*;\nimport javax.swing.event.*;\nimport javax.swing.border.*;\n\n\/** Simple JList example illustrating\n *  <ul>\n *    <li>Creating a JList, which we do by passing values \n *        directly to the JList constructor, rather than \n *        using a ListModel, and\n *    <\/li><li>Attaching a listener to determine when values change.\n *  <\/li><\/ul>\n *\/\n\npublic class JListSimpleExample extends JFrame {\n  public static void main(String[] args) {\n    new JListSimpleExample();\n  }\n\n  private JList sampleJList;\n  private JTextField valueField;\n  \n  public JListSimpleExample() {\n    super(&quot;Creating a Simple JList&quot;);\n    WindowUtilities.setNativeLookAndFeel();\n    addWindowListener(new ExitListener());\n    Container content = getContentPane();\n\n    \/\/ Create the JList, set the number of visible rows, add a\n    \/\/ listener, and put it in a JScrollPane.\n    String[] entries = { &quot;Entry 1&quot;, &quot;Entry 2&quot;, &quot;Entry 3&quot;,\n                         &quot;Entry 4&quot;, &quot;Entry 5&quot;, &quot;Entry 6&quot; };\n    sampleJList = new JList(entries);\n    sampleJList.setVisibleRowCount(4);\n    sampleJList.addListSelectionListener(new ValueReporter());\n    JScrollPane listPane = new JScrollPane(sampleJList);\n    Font displayFont = new Font(&quot;Serif&quot;, Font.BOLD, 18);\n    sampleJList.setFont(displayFont);\n\n    JPanel listPanel = new JPanel();\n    listPanel.setBackground(Color.white);\n    Border listPanelBorder =\n      BorderFactory.createTitledBorder(&quot;Sample JList&quot;);\n    listPanel.setBorder(listPanelBorder);\n    listPanel.add(listPane);\n    content.add(listPanel, BorderLayout.CENTER);\n    JLabel valueLabel = new JLabel(&quot;Last Selection:&quot;);\n    valueLabel.setFont(displayFont);\n    valueField = new JTextField(&quot;None&quot;, 7);\n    valueField.setFont(displayFont);\n    valueField.setEditable(false);\n    JPanel valuePanel = new JPanel();\n    valuePanel.setBackground(Color.white);\n    Border valuePanelBorder =\n      BorderFactory.createTitledBorder(&quot;JList Selection&quot;);\n    valuePanel.setBorder(valuePanelBorder);\n    valuePanel.add(valueLabel);\n    valuePanel.add(valueField);\n    content.add(valuePanel, BorderLayout.SOUTH);\n    pack();\n    setVisible(true);\n  }\n\n  private class ValueReporter implements ListSelectionListener {\n\n    \/** You get three events in many cases -- one for the \n     *  deselection of the originally selected entry, one \n     *  indicating the selection is moving, and one for the \n     *  selection of the new entry. In the first two cases, \n     *  getValueIsAdjusting returns true; thus, the test below\n     *  when only the third case is of interest.\n     *\/\n\n    public void valueChanged(ListSelectionEvent event) {\n      if (!event.getValueIsAdjusting()) {\n        Object value = sampleJList.getSelectedValue();\n        if (value != null) {\n          valueField.setText(value.toString());\n        }  \n      }\n    }\n  }\n}\n**\/\/\nDefaultListModelExample.java Creates a list using a DefaultListModel. By default, a JList doesn't permit you to directly add new entries; however, with the DefaultListModel you can add or delete entries to the model (which are reflected in the list). \nimport java.awt.*;\nimport java.awt.event.*;\nimport javax.swing.*;\nimport javax.swing.border.*;\n\n\/** JList example illustrating\n *  <ul>\n *    <li>The creation of a JList by creating a DefaultListModel,\n *        adding the values there, then passing that to the\n *        JList constructor.\n *    <\/li><li>Adding new values at runtime, the key thing that \n *        DefaultListModel lets you do that you can't do with\n *        a JList where you supply values directly.\n *  <\/li><\/ul>\n *\n *\/\n\npublic class DefaultListModelExample extends JFrame {\n  public static void main(String[] args) {\n    new DefaultListModelExample();\n  }\n\n  JList sampleJList;\n  private DefaultListModel sampleModel;\n  \n  public DefaultListModelExample() {\n    super(&quot;Creating a Simple JList&quot;);\n    WindowUtilities.setNativeLookAndFeel();\n    addWindowListener(new ExitListener());\n    Container content = getContentPane();\n   \n    String[] entries = { &quot;Entry 1&quot;, &quot;Entry 2&quot;, &quot;Entry 3&quot;,\n                         &quot;Entry 4&quot;, &quot;Entry 5&quot;, &quot;Entry 6&quot; };\n    sampleModel = new DefaultListModel();\n    for(int i=0; i&lt;entries .length; i++) {\n      sampleModel.addElement(entries[i]);\n    }\n    sampleJList = new JList(sampleModel);\n    sampleJList.setVisibleRowCount(4);\n    Font displayFont = new Font(&quot;Serif&quot;, Font.BOLD, 18);\n    sampleJList.setFont(displayFont);\n    JScrollPane listPane = new JScrollPane(sampleJList);\n    \n    JPanel listPanel = new JPanel();\n    listPanel.setBackground(Color.white);\n    Border listPanelBorder =\n      BorderFactory.createTitledBorder(&quot;Sample JList&quot;);\n    listPanel.setBorder(listPanelBorder);\n    listPanel.add(listPane);\n    content.add(listPanel, BorderLayout.CENTER);\n    JButton addButton =\n      new JButton(&quot;Add Entry to Bottom of JList&quot;);\n    addButton.setFont(displayFont);\n    addButton.addActionListener(new ItemAdder());\n    JPanel buttonPanel = new JPanel();\n    buttonPanel.setBackground(Color.white);\n    Border buttonPanelBorder =\n      BorderFactory.createTitledBorder(&quot;Adding Entries&quot;);\n    buttonPanel.setBorder(buttonPanelBorder);\n    buttonPanel.add(addButton);\n    content.add(buttonPanel, BorderLayout.SOUTH);\n    pack();\n    setVisible(true);\n  }\n\n  private class ItemAdder implements ActionListener {\n    \n    \/** Add an entry to the ListModel whenever the user\n     *  presses the button. Note that since the new entries\n     *  may be wider than the old ones (e.g., &quot;Entry 10&quot; vs.\n     *  &quot;Entry 9&quot;), you need to rerun the layout manager.\n     *  You need to do this <i>before trying to scroll\n     *  to make the index visible.\n     *\/\n\n    public void actionPerformed(ActionEvent event) {\n      int index = sampleModel.getSize();\n      sampleModel.addElement(&quot;Entry &quot; + (index+1));\n      ((JComponent)getContentPane()).revalidate();\n      sampleJList.setSelectedIndex(index);\n      sampleJList.ensureIndexIsVisible(index);\n    }\n  }\n}\n**\/\/\n\n# JListCustomModel.java  Example illustrating that you can use your own custom data model (data structure) to hold the entries in a list. Uses the following classes:\n\n    * JavaLocationListModel.java A custom list model (implements ListModel interface which provides support for custom data structures) to store data for the list.\n    * JavaLocationCollection.java A simple collection of JavaLocation (below) objects.\n    * JavaLocation.java An object representing a city named Java. Defines the country where the Java city is located, along with a comment and country flag (gif image).\n\nJListCustomModel.java:\nimport java.awt.*;\nimport javax.swing.*;\n\n\/** Simple JList example illustrating the use of a custom\n *  ListModel (JavaLocationListModel).\n *\n  *\/\n\npublic class JListCustomModel extends JFrame {\n  public static void main(String[] args) {\n    new JListCustomModel();\n  }\n\n  public JListCustomModel() {\n    super(&quot;JList with a Custom Data Model&quot;);\n    WindowUtilities.setNativeLookAndFeel();\n    addWindowListener(new ExitListener());\n    Container content = getContentPane();\n\n    JavaLocationCollection collection =\n      new JavaLocationCollection();\n    JavaLocationListModel listModel =\n      new JavaLocationListModel(collection);\n    JList sampleJList = new JList(listModel);\n    Font displayFont = new Font(&quot;Serif&quot;, Font.BOLD, 18);\n    sampleJList.setFont(displayFont);\n    content.add(sampleJList);\n\n    pack();\n    setVisible(true);\n  }\n}\n**\/\/\n# JavaLocationListModel.java:\n\nimport javax.swing.*;\nimport javax.swing.event.*;\n\n\/** A simple illustration of writing your own ListModel.\n *  Note that if you wanted the user to be able to add and\n *  remove data elements at runtime, you should start with\n *  AbstractListModel and handle the event reporting part.\n *\n *\/\n\npublic class JavaLocationListModel implements ListModel {\n  private JavaLocationCollection collection;\n  \n  public JavaLocationListModel(JavaLocationCollection collection) {\n    this.collection = collection;\n  }\n\n  public Object getElementAt(int index) {\n    return(collection.getLocations()[index]);\n  }\n\n  public int getSize() {\n    return(collection.getLocations().length);\n  }\n\n  public void addListDataListener(ListDataListener l) {}\n\n  public void removeListDataListener(ListDataListener l) {}\n}\n\n**\/\/\n\nJavaLocationCollection.java:\n\/** A simple collection that stores multiple JavaLocation\n *  objects in an array and determines the number of\n *  unique countries represented in the data.\n *\n *\/\n\npublic class JavaLocationCollection {\n  private static JavaLocation[] defaultLocations =\n    { new JavaLocation(&quot;Belgium&quot;,\n                       &quot;near Liege&quot;,\n                       &quot;flags\/belgium.gif&quot;),\n      new JavaLocation(&quot;Brazil&quot;,\n                       &quot;near Salvador&quot;,\n                       &quot;flags\/brazil.gif&quot;),\n      new JavaLocation(&quot;Colombia&quot;,\n                       &quot;near Bogota&quot;,\n                       &quot;flags\/colombia.gif&quot;),\n      new JavaLocation(&quot;Indonesia&quot;,\n                       &quot;main island&quot;,\n                       &quot;flags\/indonesia.gif&quot;),\n      new JavaLocation(&quot;Jamaica&quot;,\n                       &quot;near Spanish Town&quot;,\n                       &quot;flags\/jamaica.gif&quot;),\n      new JavaLocation(&quot;Mozambique&quot;,\n                       &quot;near Sofala&quot;,\n                       &quot;flags\/mozambique.gif&quot;),\n      new JavaLocation(&quot;Philippines&quot;,\n                       &quot;near Quezon City&quot;,\n                       &quot;flags\/philippines.gif&quot;),\n      new JavaLocation(&quot;Sao Tome&quot;,\n                       &quot;near Santa Cruz&quot;,\n                       &quot;flags\/saotome.gif&quot;),\n      new JavaLocation(&quot;Spain&quot;,\n                       &quot;near Viana de Bolo&quot;,\n                       &quot;flags\/spain.gif&quot;),\n      new JavaLocation(&quot;Suriname&quot;,\n                       &quot;near Paramibo&quot;,\n                       &quot;flags\/suriname.gif&quot;),\n      new JavaLocation(&quot;United States&quot;,\n                       &quot;near Montgomery, Alabama&quot;,\n                       &quot;flags\/usa.gif&quot;),\n      new JavaLocation(&quot;United States&quot;,\n                       &quot;near Needles, California&quot;,\n                       &quot;flags\/usa.gif&quot;),\n      new JavaLocation(&quot;United States&quot;,\n                       &quot;near Dallas, Texas&quot;,\n                       &quot;flags\/usa.gif&quot;)\n    };\n\n  private JavaLocation[] locations;\n  private int numCountries;\n\n  public JavaLocationCollection(JavaLocation[] locations) {\n    this.locations = locations;\n    this.numCountries = countCountries(locations);\n  }\n  \n  public JavaLocationCollection() {\n    this(defaultLocations);\n  }\n\n  public JavaLocation[] getLocations() {\n    return(locations);\n  }\n\n  public int getNumCountries() {\n    return(numCountries);\n  }\n\n  \/\/ Count the number of unique countries in the data.\n  \/\/ Assumes the list is sorted by country name\n  private int countCountries(JavaLocation[] locations) {\n    int n = 0;\n    String currentCountry, previousCountry = &quot;None&quot;;\n    for(int i=0;i&lt;locations .length;i++) {\n      currentCountry = locations[i].getCountry();\n      if (!previousCountry.equals(currentCountry)) {\n        n++;\n     }\n      currentCountry = previousCountry;\n    }\n    return(n);\n  }\n}\n**\/\/\n\nJavaLocation.java :\n\/** Simple data structure with three properties: country,\n *  comment, and flagFile. All are strings, and they are\n *  intended to represent a country that has a city or\n *  province named &quot;Java,&quot; a comment about a more\n *  specific location within the country, and a path\n *  specifying an image file containing the country&#039;s flag.\n *  Used in examples illustrating custom models and cell\n *  renderers for JLists.\n *\n  *\/\n\npublic class JavaLocation {\n  private String country, comment, flagFile;\n\n  public JavaLocation(String country, String comment,\n                      String flagFile) {\n    setCountry(country);\n    setComment(comment);\n    setFlagFile(flagFile);\n  }\n\n  \/** String representation used in printouts and in JLists *\/\n  \n  public String toString() {\n    return(&quot;Java, &quot; + getCountry() + &quot; (&quot; + getComment() + &quot;).&quot;);\n  }\n  \n  \/** Return country containing city or province named &quot;Java.&quot; *\/\n  \n  public String getCountry() {\n    return(country);\n  }\n\n  \/** Specify country containing city or province named &quot;Java.&quot; *\/\n  \n  public void setCountry(String country) {\n    this.country = country;\n  }\n\n  \/** Return comment about city or province named &quot;Java.&quot;\n   *  Usually of the form &quot;near such and such a city.&quot;\n   *\/\n  \n  public String getComment() {\n    return(comment);\n  }\n\n  \/** Specify comment about city or province named &quot;Java&quot;. *\/\n\n  public void setComment(String comment) {\n    this.comment = comment;\n  }\n  \n  \/** Return path to image file of country flag. *\/\n  \n  public String getFlagFile() {\n    return(flagFile);\n  }\n\n  \/** Specify path to image file of country flag. *\/\n  \n  public void setFlagFile(String flagFile) {\n    this.flagFile = flagFile;\n  }\n}\n**\/\/\n\nJListCustomRenderer.java  A list can contain items other than Strings; however, the list needs to know how to render (display) the different items. In this example, a custom cell renderer is used to display each JavaLocation as a JLabel containing an Icon (for the flag) and text (country and description). Uses the following classes and images:\nimport java.awt.*;\nimport javax.swing.*;\n\n\/** Simple JList example illustrating the use of a custom\n *  cell renderer (JavaLocationRenderer).\n *\n  *\/\n\npublic class JListCustomRenderer extends JFrame {\n  public static void main(String[] args) {\n    new JListCustomRenderer();\n  }\n\n  public JListCustomRenderer() {\n    super(&quot;JList with a Custom Cell Renderer&quot;);\n    WindowUtilities.setNativeLookAndFeel();\n    addWindowListener(new ExitListener());\n    Container content = getContentPane();\n\n    JavaLocationCollection collection = \n      new JavaLocationCollection();\n    JavaLocationListModel listModel =\n      new JavaLocationListModel(collection);\n    JList sampleJList = new JList(listModel);\n    sampleJList.setCellRenderer(new JavaLocationRenderer());\n    Font displayFont = new Font(&quot;Serif&quot;, Font.BOLD, 18);\n    sampleJList.setFont(displayFont);\n    content.add(sampleJList);\n\n    pack();\n    setVisible(true);\n  }\n}\n**\/\/\n\n# JavaLocationRenderer.java Simple custom renderer that builds the JLabel for each item to display in the list.\n\nimport javax.swing.*;\nimport java.awt.*;\nimport java.util.*;\n\n\/** Simple custom cell renderer. The idea here is to augment\n *  the default renderer instead of building one from scratch. \n *  The advantage of this approach is that you don&#039;t have to \n *  handle the highlighting of the selected entries yourself, \n *  plus values that aren&#039;t of the new type you want to draw can \n *  be handled automatically. The disadvantage is that you are \n *  limited to a variation of a JLabel, which is what the default \n *  renderer returns.\n *  <p>\n *  Note that this method can get called lots and lots of times\n *  as you click on entries. We don't want to keep generating \n *  new ImageIcon objects, so we make a Hashtable that associates \n *  previously displayed values with icons, reusing icons for \n *  entries that have been displayed already.\n *  <\/p><p>\n *  Note that in the first release of JDK 1.2, the default \n *  renderer  has a bug: the renderer doesn't clear out icons for \n *  later entries. So if you mix plain strings and ImageIcons in \n *  your JList, the plain strings still get an icon. The \n *  call below clears the old icon when the value is not a \n *  JavaLocation.\n *\n \n *\/\n\npublic class JavaLocationRenderer extends \n                                  DefaultListCellRenderer {\n  private Hashtable iconTable = new Hashtable();\n  \n  public Component getListCellRendererComponent(JList list,\n                                                Object value,\n                                                int index,\n                                                boolean isSelected,\n                                                boolean hasFocus) {\n    \/\/ First build the label containing the text, then \n    \/\/ later add the image.\n    JLabel label =\n      (JLabel)super.getListCellRendererComponent(list,\n                                                 value,\n                                                 index,\n                                                 isSelected,\n                                                 hasFocus);\n    if (value instanceof JavaLocation) {\n      JavaLocation location = (JavaLocation)value;\n      ImageIcon icon = (ImageIcon)iconTable.get(value);\n      if (icon == null) {\n        icon = new ImageIcon(location.getFlagFile());\n        iconTable.put(value, icon);\n      }\n      label.setIcon(icon);\n    } else {\n      \/\/ Clear old icon; needed in 1st release of JDK 1.2.\n      label.setIcon(null); \n    }\n    return(label);\n  }\n}\n**\/\/\n# JavaLocationListModel.java A custom list model (implements ListModel interface) to store data for a list.\n# JavaLocationCollection.java A simple collection of JavaLocation (below) objects.\n# JavaLocation.java An object representing a city named Java. Defines the country where the Java city is located, along with a comment and country flag\n\n<\/p><\/i><\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10299<br \/> Categories:Programming Code Examples, Java\/J2EE\/J2ME, Advanced Swing<br \/>Tags:Java\/J2EE\/J2MEAdvanced Swing<br \/> Post Data:2017-01-02 16:04:31<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>All examples, except for FileTransfer use WindowUtilities.java and ExitListener.java. WindowUtilities.java: import javax.swing.*; import java.awt.*; \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. * *\/ public class WindowUtilities { \/** Tell system to use native look and feel, as in previous * releases. Metal (Java) LAF is the &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=27188\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-27188","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":26791,"url":"http:\/\/bangla.sitestree.com\/?p=26791","url_meta":{"origin":27188,"position":0},"title":"Simplifies the setting of native look and feel #Programming Code Examples #Java\/J2EE\/J2ME #Layout Managers","author":"Author-Check- Article-or-Video","date":"May 1, 2021","format":false,"excerpt":"WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*; \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. * ################### public class WindowUtilities { \/** Tell system to use native look and feel, as in previous * releases.\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10323,"url":"http:\/\/bangla.sitestree.com\/?p=10323","url_meta":{"origin":27188,"position":1},"title":"Simplifies the setting of native look and feel","author":"","date":"August 26, 2015","format":false,"excerpt":"WindowUtilities.java Simplifies the setting of native look and feel. #################### import javax.swing.*; import java.awt.*;\u00a0\u00a0 \/\/ For Color and Container classes. \/** A few utilities that simplify using windows in Swing. \u00a0* ################### public class WindowUtilities { \u00a0 \/** Tell system to use native look and feel, as in previous \u00a0\u00a0\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26818,"url":"http:\/\/bangla.sitestree.com\/?p=26818","url_meta":{"origin":27188,"position":2},"title":"PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. #Programming Code Examples #Java\/J2EE\/J2ME #JSP","author":"Author-Check- Article-or-Video","date":"May 2, 2021","format":false,"excerpt":"PluginApplet.jsp Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10146,"url":"http:\/\/bangla.sitestree.com\/?p=10146","url_meta":{"origin":27188,"position":3},"title":"PluginApplet.jsp Page that demonstrates the use of jsp:plugin.","author":"","date":"August 12, 2015","format":false,"excerpt":"PluginApplet.jsp\u00a0 Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java\u00a0 Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF\/classes directory where\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10245,"url":"http:\/\/bangla.sitestree.com\/?p=10245","url_meta":{"origin":27188,"position":4},"title":"DOM example that represents the basic structure of an XML document as a JTree","author":"","date":"August 25, 2015","format":false,"excerpt":"\/\/XMLTree.java \/\/Uses the following files Uses the following files: \u00a0\u00a0\u00a0 * XMLFrame.java:Swing application to select an XML document and display in a JTree. ExtensionFileFilter.java Allows you to specify which file extensions will be displayed in a JFileChooser. test.xml Default file loaded if none selected by user. perennials.xml and perennials.dtd Data\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26856,"url":"http:\/\/bangla.sitestree.com\/?p=26856","url_meta":{"origin":27188,"position":5},"title":"DOM example that represents the basic structure of an XML document as a JTree #Programming Code Examples #Java\/J2EE\/J2ME #JavaScript","author":"Author-Check- Article-or-Video","date":"May 3, 2021","format":false,"excerpt":"\/\/XMLTree.java \/\/Uses the following files Uses the following files: * XMLFrame.java:Swing application to select an XML document and display in a JTree. ExtensionFileFilter.java Allows you to specify which file extensions will be displayed in a JFileChooser. test.xml Default file loaded if none selected by user. perennials.xml and perennials.dtd Data on\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27188","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27188"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/27188\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27188"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27188"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27188"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}