Seat Reservation Component Choosing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesti
    New Member
    • Nov 2007
    • 144

    #1

    Seat Reservation Component Choosing

    hi,

    i'm asked to create a program in which there's a component like this



    it's like a seat reservation program. in which we are able to click-and-drag to select the box/es.
    i wonder what component or array of components that suites the needs.
    i think of using JTable, does JTable support single cell selection?

    thx
  • thesti
    New Member
    • Nov 2007
    • 144

    #2
    i'm sorry, i thought that the image is displayed. bcause it is at my computer.
    maybe i need to know how to display an image first. i'm so noob

    thx

    Comment

    • BigDaddyLH
      Recognized Expert Top Contributor
      • Dec 2007
      • 1216

      #3
      JTable can support single cell selection:
      [CODE=java]import java.awt.*;
      import javax.swing.*;

      public class TableExample implements Runnable {
      public static void main(String[] args) {
      EventQueue.invo keLater(new TableExample()) ;
      }

      public void run() {
      JTable table = new JTable(10, 5);
      table.setCellSe lectionEnabled( true);
      table.setSelect ionMode(ListSel ectionModel.SIN GLE_SELECTION);

      JFrame f = new JFrame("TableEx ample");
      f.getContentPan e().add(new JScrollPane(tab le));
      f.pack();
      f.setDefaultClo seOperation(Win dowConstants.EX IT_ON_CLOSE);
      f.setLocationRe lativeTo(null);
      f.setVisible(tr ue);
      }
      }
      [/CODE]

      Comment

      Working...