JTable with AUTO_RESIZE_OFF not resizing at all!

I tried to find solution in other posts, but no success.
I created a JTable with
table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);That�s fine, but now I can�t resize it at all while interacting with it.
That�s the main code of the table.
I�d appreciate any any help.
Thanks in advice.
        int preferredWidth = 0;
        int preferredSizeSum = 0;
        //Rebuild TableColumnModel with correct number of columns
        ((AbstractTableModel)getTable().getModel()).fireTableStructureChanged();
        //Set the columns widths based on the field data
        TableColumnModel columnModel = getTable().getColumnModel();
        for (int i = 0; i <= multiProperties.size(); i++) {                       
            TableColumn column = columnModel.getColumn(i);
            //Start with the reported column width
            preferredWidth = column.getWidth();
            //Enforce minimum width needed to display column header text
            preferredWidth = Math.max(preferredWidth, ((AbstractTableModel)getTable().getModel()).getColumnName(i).length() * 10);
            //Enforce maximum width so long fields get truncated
            preferredWidth = Math.min(preferredWidth, 200);
            //Set the column width
            column.setPreferredWidth( preferredWidth );
            column.setMinWidth( 5 );
            column.setMaxWidth( 500 );
            preferredSizeSum += preferredWidth;
        getTable().setMaximumSize( new Dimension( 500*multiProperties.size(), tableHeight ) );
        getTable().setMinimumSize( new Dimension( 5*multiProperties.size(), tableHeight ) );
        getTable().setPreferredSize( new Dimension( preferredSizeSum, tableHeight ) );       
        getTable().setSize( new Dimension( preferredSizeSum, tableHeight ) );

Works fine for me:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=623692
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.

Similar Messages

  • We have version 10.5.8 photoshop CS3 for Mac. How do we fix a problem with photoshop not resizing dpi? For example we resized a 72 dpi image to 200 dpi, when we do a pdf analysis it read as 344 dpi.

    We have version 10.5.8 photoshop CS3 for Mac. How do we fix a problem with photoshop not resizing dpi? For example we resized a 72 dpi image to 200 dpi, when we do a pdf analysis it read as 344 dpi.

    Sounds like it's a problem with the Acrobat settings. Did you set them to the same resolution?

  • JTable with DefaultTableModel not showing?

    I hope this is SSCE...
    I'm using a defaultTableModel, but I cannot get the Table to show.
    When I just simply put the vectors straight into the table, without using the DefaultTableModel it worked.
    This is the code I have now, the table doesn't show at all?
    I actually couldn't get this example to compile, as it only contains snippets of the code. The real code compiles and runs, but the table just doesn't show. I guess it's all part of the same problem.
    If someone could help me with where I've gone wrong in the usage of the DefaultTableModel, it would be greatly appreciated.
    import java.util.Vector;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.TableModel;
    import javax.swing.*;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.event.*;
    public class FutureTable extends JTable implements TableModelListener {
         Vector colnames = new Vector();
         Vector inne = new Vector();
         TableModel model;
         JTable table = new JTable();
         public FutureTable(){
              //vector colnames
              colnames.addElement("Date");
              //vector inne
              inne.addElement("example")
              //Adds inne and colnames to the TableModel model
              model = new DefaultTableModel(inne, colnames);
              //sets Table to TableModel model
              table.setModel(model);
              //adds a listener to the table
              table.getModel().addTableModelListener(this);
    import javax.swing.*;
    import java.awt.*;
    import java.util.Vector;
    public class FutureTableHolder extends JPanel {
         Vector inne = new Vector();     
         JScrollPane scrollPane;     
         FutureTable theTable = new FutureTable();
         public FutureTableHolder() {          
              //Sets the layout to gridlayout so that the table will fill the panel.
              setLayout(new GridLayout(1,0));
              scrollPane= new JScrollPane(theTable);//ScrollPane
              add(scrollPane);
         }//Ends FutureTableHolder()     
         

    When I just simply put the vectors straight into the table, without using the DefaultTableModel it worked. Well, the code is the same.
    You can use:
    JTable table = new JTable(data, columnNames);or
    DefaultTableModel model = new DefaultTableModel(data, columnNames);
    JTable table = new JTable( model );So you obviously have a problem with your code and you are not building the Vectors the same way. Since you did not post a SSCCE, we can't help (Although as noted above your data Vector is empty so there is no data to display).

  • X58m and problem with eSata NOT recognized at all, even at bios post

    Hardware:
    i7 920 & msi x58m
    12 gb ocx platium tri channel DDR3 1333 (running at 1066)
    Sapphire 4890 Toxic 1 GB Ram Vapor Coooled Video
    Raid 0 Seagate 750 GB (two striped drives)
    CoolerMaster Gemini IIs Heat Pipe CPU cooler
    Bios flashed though MSI auto flash in windows mode (1.4?)
    issue: Thernaltake BlaqX Esata/USB docking station NOT recognized
    Windows 7 64 bit insalled perfectly.. programs installed perfectly
    I have two ways to connect to eSata
    1- rear eSata port that is already built onto the rear panel of board
    2- internal sata (front panel has cable running to 7th 'isolate' sata port)
    Docking station works perfect on my winXP machine
    Works perfect on my Dell notebook with Win 7 32 bit
    Docknig station works on ALL machines when using USB cable
    On boot post, msi x58m does not report the extra drive being present
    Help!

    Quote from: NovJoe on 20-July-09, 21:49:41
    Have you install all JMicron drivers (including RAID) for the board yet?
    Windows 7 handles these issues, because the device WORKS on my notebook that has windows 7 (32 bit). Mind you, I did a fresh install of windows on my notebook, so it wasn't Dell who installed those drivers for me.
    Also, the devices are NOT showing in the post screen at first boot -- again the jMicron suggestion is moot.

  • WHO ELSE IS HAVING WITH IDVD NOT OPENING AT ALL AFTER INSTALLING UPDATES???

    This is bad.
    APPLE FIGURE IT OUT.
    Email me at [email protected]
    I have a project due tomorrow.
    Thanks
    it "FAILS TO LAUNCH"
    I FAIL TO LIKE APPLE RIGHT NOW!

    Hi
    Very few Apple people are reading this forum. It's a User to User forum.
    I would try to delete the pref files (or rather start a new user account) to see
    if it runns OK.
    or read collected material:
    *Not knowing the origin to Your problem - General approach when in trouble is as follows:*
    • Free space on internal (start-up) hard disk if it is less than 10Gb should rather have 25Gb
    • Hard disk is untidy: Repair Permissions, Repair Hard disk (Apple Disc Util tool)
    • Delete iDVD pref file - *or rather start a new user/account* - log into this and re-try
    • Program miss-match: iDVD 5.0.2, Mac OS X.4.11 AND QuickTime 7.4.1 - is OK - DON’T work under Leopard
    • Program miss-match: iDVD 6.0.4, Mac OS X.4.11 AND QuickTime 7.4.1 - is OK (might work under Leopard)
    • Program miss-match: iDVD’08 v. 7.0.1, Mac OS X.4.11 AND QuickTime 7.4.1 - is OK (might work under Leopard)
    • iDVD (08) v7 Locate theme folder. Move out iDVD1, iDVD 2 and eventually iDVD4 folders to desktop - re-try
    • Try a Cleaning CD/DVD that cleans the laser lens on the DVD burner/player
    iDVD 6.0.4 and iDVD 7.0.1 are compatible with Mac OS X 10.5 Leopard
    iDVD pref file resides: Mac Hard Disk (start-up HD)/Users/"Your account"/Library/Preferences and is named:
    com.apple.iDVD.plist
    While iDVD is NOT RUNNING - move this file out to desk-top.
    Now restart iDVD.
    Last resort: from Craig: Solved the problem!! Finally!!
    I deleted every iDVD application and folder from my boot drive,
    emptied the trash and then installed iDVD 08 using the customize option
    and I am up and running.
    Yours (a User) Bengt W

  • Phone won't charge or sync with computer, not recognized at all

    My iphone has always been a bit picky about syncing. But now, it won't sync at all. I can charge via car or wall, but not computer.
    When I plug the phone into the computer, it does nothing. I've tried different cables, and every computer in the house. itunes does not show the phone, and teh phone does not show that it is plugged in. Is there anything I can try short of getting a new phone? This one is out of warranty.

    I have tried powering down the phone, and plugging in while holding home button. The screen comes up to connect to itunes, but itunes shows nothing, and phone shows not plugged in.

  • Some Panels will not Resize

    Working on Windows XP SP2, IDCS3. A friend's paragraph panel and one other panel will not resize. All other panels function normally.
    We tried:
    - Resetting her preferences
    - Resetting her panels
    - Closing and reopening the particular 2 panels
    - Moving the panels to different parts of the screen (docked, undocked)
    No luck. Any ideas?

    Hit http://www.pixentral.com.
    Read the directions. When the image you upload is processed and displayed, scroll down below it and copy ALL of the code in the box next to "HTML". (Ignore the "Forum" code box)
    Paste that copied code into a message here. It will generate and display a thumbnail; clicking on the thumbnail takes you to the full size image you uploaded.

  • Node Container that does not resize with Window Resize Event

    Hello,
    I'm not new to Java but I am new to JavaFX.
    I plan to have a container/Canvas with multiple shapes (Lines, Text, Rectangle etc) in it. This Container can be X times in the Szene with different Text Shapes. I need to Zoom and Pan (maybe rotation) the whole Szene and the Containers/Canvas.
    So I was playing around with that but I have two issues.
    1) all Canvas classes that I found (like Pane for example) do resize with the main window resize event. The content of the canvas isn't centered any more.
    2) I added a couple of Rectangles to the canvas and both the rectangles and the canvas have a mouse listener which will rotate the item/canvas. Problem is, that even if I click the rectangle also the underlaying canvas is rotated...I think I need some kind of Z-Info to find out what was clicked.
    Here is the little example program, it makes no produktiv sense but it demonstrates my problem.
    Does anybody has a tip what canvas class would fit and does not resize with the main window and how to figure out what was clicked?
    public class Test extends Application
         Scene mainScene;
         Group root;
         public static void main(String[] args)
            launch(args);
        @Override
        public void init()
            root = new Group();
            int x = 0;
            int y = -100;
            for(int i = 0; i < 5; i++)
                 x = 0;
                 y = y + 100;
                 for (int j = 0; j < 5; j++)
                      final Rectangle rect = new Rectangle(x, y, 30 , 30);
                       final RotateTransition rotateTransition = RotateTransitionBuilder.create()
                             .node(rect)
                             .duration(Duration.seconds(4))
                             .fromAngle(0)
                             .toAngle(720)
                             .cycleCount(Timeline.INDEFINITE)
                             .autoReverse(true)
                             .build();
                     rect.setOnMouseClicked(new EventHandler<MouseEvent>()
                          public void handle(MouseEvent me)
                               if(rotateTransition.getStatus().equals(Animation.Status.RUNNING))
                                    rotateTransition.setToAngle(0);
                                    rotateTransition.stop();
                                    rect.setFill(Color.BLACK);
                                    rect.setScaleX(1.0);
                                    rect.setScaleY(1.0);
                               else
                                    rect.setFill(Color.AQUAMARINE);
                                    rect.setScaleX(2.0);
                                    rect.setScaleY(2.0);
                                    rotateTransition.play();
                      root.getChildren().add(rect);
                      x = x + 100;
        public void start(Stage primaryStage)
             final Pane pane = new Pane();
             pane.setStyle("-fx-background-color: #CCFF99");
             pane.setOnScroll(new EventHandler<ScrollEvent>()
                   @Override
                   public void handle(ScrollEvent se)
                        if(se.getDeltaY() > 0)
                             pane.setScaleX(pane.getScaleX() + 0.01);
                             pane.setScaleY(pane.getScaleY() + 0.01);
                        else
                             pane.setScaleX(pane.getScaleX() - 0.01);
                             pane.setScaleY(pane.getScaleY() - 0.01);
             pane.getChildren().addAll(root);
             pane.setOnMouseClicked(new EventHandler<MouseEvent>(){
                   @Override
                   public void handle(MouseEvent event)
                        System.out.println(event.getButton());
                        if(event.getButton().equals(MouseButton.PRIMARY))
                             System.out.println("primary button");
                             final RotateTransition rotateTransition2 = RotateTransitionBuilder.create()
                                  .node(pane)
                                  .duration(Duration.seconds(10))
                                  .fromAngle(0)
                                  .toAngle(360)
                                  .cycleCount(Timeline.INDEFINITE)
                                  .autoReverse(false)
                                  .build();
                             rotateTransition2.play();
             mainScene = new Scene(pane, 400, 400);
             primaryStage.setScene(mainScene);
            primaryStage.show();
    }Edited by: 953596 on 19.08.2012 12:03

    To answer my own Question, it depends how you add childs.
    It seems that the "master Container", the one added to the Scene will allways resize with the window. To avoid that you can add a container to the "master Container" and tell it to be
    pane.setPrefSize(<child>.getWidth(), <child>.getHeight());
    pane.setMaxSize(<child>.getWidth(), <child>.getHeight());
    root.getChildren().add(pane);and it will stay the size even if the window is resized.
    Here is the modified code. Zooming and panning is working, zomming to window size is not right now. I'll work on that.
    import javafx.animation.Animation;
    import javafx.animation.ParallelTransition;
    import javafx.animation.ParallelTransitionBuilder;
    import javafx.animation.RotateTransition;
    import javafx.animation.RotateTransitionBuilder;
    import javafx.animation.ScaleTransitionBuilder;
    import javafx.animation.Timeline;
    import javafx.animation.TranslateTransitionBuilder;
    import javafx.application.Application;
    import javafx.event.EventHandler;
    import javafx.geometry.Point2D;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.input.MouseButton;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.input.ScrollEvent;
    import javafx.scene.layout.Pane;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.stage.Stage;
    import javafx.util.Duration;
    public class Test extends Application
         Stage primStage;
        Scene mainScene;
         Group root;
         Pane masterPane;
         Point2D dragAnchor;
         double initX;
        double initY;
         public static void main(String[] args)
            launch(args);
        @Override
        public void init()
            root = new Group();
            final Pane pane = new Pane();
            pane.setStyle("-fx-background-color: #CCFF99");
            pane.setOnScroll(new EventHandler<ScrollEvent>()
                @Override
                public void handle(ScrollEvent se)
                    if(se.getDeltaY() > 0)
                        pane.setScaleX(pane.getScaleX() + pane.getScaleX()/15);
                        pane.setScaleY(pane.getScaleY() + pane.getScaleY()/15);
                        System.out.println(pane.getScaleX() + " " + pane.getScaleY());
                    else
                        pane.setScaleX(pane.getScaleX() - pane.getScaleX()/15);
                        pane.setScaleY(pane.getScaleY() - pane.getScaleY()/15);
                        System.out.println(pane.getScaleX() + " " + pane.getScaleY());
            pane.setOnMousePressed(new EventHandler<MouseEvent>()
                public void handle(MouseEvent me)
                    initX = pane.getTranslateX();
                    initY = pane.getTranslateY();
                    dragAnchor = new Point2D(me.getSceneX(), me.getSceneY());
            pane.setOnMouseDragged(new EventHandler<MouseEvent>()
                public void handle(MouseEvent me) {
                    double dragX = me.getSceneX() - dragAnchor.getX();
                    double dragY = me.getSceneY() - dragAnchor.getY();
                    //calculate new position of the pane
                    double newXPosition = initX + dragX;
                    double newYPosition = initY + dragY;
                    //if new position do not exceeds borders of the rectangle, translate to this position
                    pane.setTranslateX(newXPosition);
                    pane.setTranslateY(newYPosition);
            int x = 0;
            int y = -100;
            for(int i = 0; i < 5; i++)
                 x = 0;
                 y = y + 100;
                 for (int j = 0; j < 5; j++)
                      final Rectangle rect = new Rectangle(x, y, 30 , 30);
                       final RotateTransition rotateTransition = RotateTransitionBuilder.create()
                             .node(rect)
                             .duration(Duration.seconds(4))
                             .fromAngle(0)
                             .toAngle(720)
                             .cycleCount(Timeline.INDEFINITE)
                             .autoReverse(true)
                             .build();
                     rect.setOnMouseClicked(new EventHandler<MouseEvent>()
                          public void handle(MouseEvent me)
                               if(rotateTransition.getStatus().equals(Animation.Status.RUNNING))
                                    rotateTransition.setToAngle(0);
                                    rotateTransition.stop();
                                    rect.setFill(Color.BLACK);
                                    rect.setScaleX(1.0);
                                    rect.setScaleY(1.0);
                               else
                                    rect.setFill(Color.AQUAMARINE);
                                    rect.setScaleX(2.0);
                                    rect.setScaleY(2.0);
                                    rotateTransition.play();
                      pane.getChildren().add(rect);
                      x = x + 100;
            pane.autosize();
            pane.setPrefSize(pane.getWidth(), pane.getHeight());
            pane.setMaxSize(pane.getWidth(), pane.getHeight());
            root.getChildren().add(pane);
            masterPane = new Pane();
            masterPane.getChildren().add(root);
            masterPane.setStyle("-fx-background-color: #AABBCC");
            masterPane.setOnMousePressed(new EventHandler<MouseEvent>()
               public void handle(MouseEvent me)
                   System.out.println(me.getButton());
                   if((MouseButton.MIDDLE).equals(me.getButton()))
                       double screenWidth  = masterPane.getWidth();
                       double screenHeight = masterPane.getHeight();
                       System.out.println("screenWidth  " + screenWidth);
                       System.out.println("screenHeight " + screenHeight);
                       System.out.println(screenHeight);
                       double scaleXIs     = pane.getScaleX();
                       double scaleYIs     = pane.getScaleY();
                       double paneWidth    = pane.getWidth()  * scaleXIs;
                       double paneHeight   = pane.getHeight() * scaleYIs;
                       double screenCalc    = screenWidth > screenHeight ? screenHeight : screenWidth;
                       double scaleOperator = screenCalc  / paneWidth;
                       double moveToX       = (screenWidth/2)  - (paneWidth/2);
                       double moveToY       = (screenHeight/2) - (paneHeight/2);
                       System.out.println("movetoX :" + moveToX);
                       System.out.println("movetoY :" + moveToY);
                       //double scaleYTo = screenHeight / paneHeight;
                       ParallelTransition parallelTransition = ParallelTransitionBuilder.create()
                               .node(pane)
                               .children(
                                   TranslateTransitionBuilder.create()
                                       .duration(Duration.seconds(2))
                                       .toX(moveToX)
                                       .toY(moveToY)
                                       .build()
                                   ScaleTransitionBuilder.create()
                                       .duration(Duration.seconds(2))
                                       .toX(scaleOperator)
                                       .toY(scaleOperator)
                                       .build()
                      .build();
                       parallelTransition.play();
        public void start(Stage primaryStage)
             primStage = primaryStage;
            mainScene = new Scene(masterPane, 430, 430);
             primaryStage.setScene(mainScene);
            primaryStage.show();
    }

  • JTable with custom column model and table model not showing table header

    Hello,
    I am creating a JTable with a custom table model and a custom column model. However the table header is not being displayed (yes, it is in a JScrollPane). I've shrunk the problem down into a single compileable example:
    Thanks for your help.
    import javax.swing.*;
    import javax.swing.table.*;
    public class Test1 extends JFrame
         public static void main(String args[])
              JTable table;
              TableColumnModel colModel=createTestColumnModel();
              TestTableModel tableModel=new TestTableModel();
              Test1 frame=new Test1();
              table=new JTable(tableModel, colModel);
              frame.getContentPane().add(new JScrollPane(table));
              frame.setSize(200,200);
              frame.setVisible(true);
         private static DefaultTableColumnModel createTestColumnModel()
              DefaultTableColumnModel columnModel=new DefaultTableColumnModel();
              columnModel.addColumn(new TableColumn(0));
              return columnModel;
         static class TestTableModel extends AbstractTableModel
              public int getColumnCount()
                   return 1;
              public Class<?> getColumnClass(int columnIndex)
                   return String.class;
              public String getColumnName(int column)
                   return "col";
              public int getRowCount()
                   return 1;
              public Object getValueAt(int row, int col)
                   return "test";
              public void setValueAt(Object aValue, int rowIndex, int columnIndex)
    }Edited by: 802416 on 14-Oct-2010 04:29
    added                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

    Kleopatra wrote:
    jduprez wrote:
    See http://download.oracle.com/javase/6/docs/api/javax/swing/table/TableColumn.html#setHeaderValue(java.lang.Object)
    When the TableColumn is created, the default headerValue  is null
    So, the header ends up rendered as an empty label (probably of size 0 if the JTable computes its header size based on the renderer's preferred size).nitpicking (can't resist - the alternative is a cleanup round in some not so nice code I produced recently <g>):
    - it's not the JTable's business to compute its headers size (and it doesn't, the header's the culprit.) *> - the header should never come up with a zero (or near-to) height: even if there is no title shown, it's still needed as grab to resize/move the columns. So I would consider this sizing behaviour a bug.*
    - furthermore, the "really zero" height is a longstanding issue with MetalBorder.TableHeaderBorder (other LAFs size with the top/bottom of their default header cell border) which extends AbstractBorder incorrectly. That's easy to do because AbstractBorder itself is badly implemented
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6459419
    Thanks for the opportunity to have some fun :-)
    JeanetteNo problem, thanks for the insight :)

  • JTable with ImageIcons does not react to even handling

    Hi.
    I have a populated JTable with ONLY ImageIcons in it. I need to generate event responses on mouseClicks. However, any event listener I associate with this, nothing seems to be happening.
    (Somehow, I'm guess the ImageIcons - which are rendered on a JLabel, are/is the source of all troubles!!)
    The code is below :
    import java.io.File;
    import java.awt.Point;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Container;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.ImageIcon;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    *     Entry point for the Images Table.
    *     @author Raj Gaurav
    public class SpecialCharacterDialog extends JDialog{
         String collectionString[] = null;
         ImageIcon suite[] = null;
         public SpecialCharacterDialog() {
              Container contentPane = getContentPane();
              //     Create the Table Model and create the Table from the model
              MyTableModel model = new MyTableModel();
              JTable table = new JTable(model);
              table.setDefaultRenderer(ImageIcon.class, new CustomCellRenderer());
              table.setCellSelectionEnabled(true);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = table.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No rows are selected.");
    } else {
    int selectedRow = lsm.getMinSelectionIndex();
    System.out.println("Row " + selectedRow
    + " is now selected.");
              //     Add the table to the contentPane
              JScrollPane pane = new JScrollPane(table);
              contentPane.add(pane);
    *     This class contains all the DATA information, the ImageIcons
    *     needed for display.
    class SymbolCollection {
         final static int NUMBER_OF_COLUMNS = 15;
         private String collectionString[] = null;
         private ImageIcon suite[] = null;
         *     Constructor : Initialises all the ImageIcon and their Names.
         public SymbolCollection() {
              File f = new File("C:\\Test\\Images");
              collectionString = f.list();
              int numberOfImages = collectionString.length;
              suite = new ImageIcon[numberOfImages];
              for(int i = 0;i < numberOfImages; i++) {
                   suite[i] = new ImageIcon("C:\\Test\\images" + File.separator + collectionString);
         *     Returns the total number of images in "images" folder.
         public int getTotalNumberOfImages() {
              return suite.length;
         *     Returns the target ImageIcon.
         public ImageIcon getImageIconAt(int number) {
              return suite[number];
         *     Returns the target ImageIcon Name.
         public String getImageIconNameAt(int number) {
              return collectionString[number];
         *     Returns an array of ALL the ImageIcons available.
         public ImageIcon[] getImageIcons() {
              return suite;
         *     Returns an array of ALL the ImageIcon names available
         public String[] getImageIconNames() {
              return collectionString;
         *     Returns TRUE for all cells
         public boolean isEditable(int row, int col) {
              return true;
    *     Defines the table model for the tabel.
    class MyTableModel extends AbstractTableModel {
         private SymbolCollection collection = null;
         private Object data[][] = null;
         *     Constructor for the TableModel. Initialises the "data" field for table.
         public MyTableModel() {
              int countOfImages = 0;
              collection = new SymbolCollection();
              data = new Object[getRowCount()][SymbolCollection.NUMBER_OF_COLUMNS];
              for(int i = 0; i < getRowCount(); i++) {
                   for(int j = 0; j < SymbolCollection.NUMBER_OF_COLUMNS; j++) {
                        if(countOfImages == collection.getTotalNumberOfImages()) {
                             break;
                        data[i][j] = collection.getImageIconAt(countOfImages);
                        countOfImages++;
         *     Returns the number of rows for this table.
         *     It is calculated as : TotalNumber/NumberOfColumns if remainder is ZERO or,
         *                              TotalNumber/NumberOfColumns + 1 if not.
         public int getRowCount() {
              int numberOfRows = collection.getTotalNumberOfImages()/SymbolCollection.NUMBER_OF_COLUMNS;
              if(numberOfRows == 0) {
                   return numberOfRows;
              else {
                   return numberOfRows + 1;
         *     Returns the number of Columns for this table
         public int getColumnCount() {
              return SymbolCollection.NUMBER_OF_COLUMNS;
         *     Returns the CLASS data type for this table
         public Class getColumnClass(int col) {
              return collection.getImageIconAt(0).getClass();
         *     Returns the table data at (row, col).
         public Object getValueAt(int row, int col) {
              return data[row][col];
    *     Renders the table to display images in individual cells
    class CustomCellRenderer extends JLabel implements TableCellRenderer {
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
              setIcon((ImageIcon)value);
              return this;

    Hi.
    I have a populated JTable with ONLY ImageIcons in it. I need to generate event responses on mouseClicks. However, any event listener I associate with this, nothing seems to be happening.
    (Somehow, I'm guess the ImageIcons - which are rendered on a JLabel, are/is the source of all troubles!!)
    The code is below :
    import java.io.File;
    import java.awt.Point;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Container;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JDialog;
    import javax.swing.JLabel;
    import javax.swing.JTable;
    import javax.swing.ImageIcon;
    import javax.swing.JScrollPane;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.TableColumn;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.AbstractTableModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    *     Entry point for the Images Table.
    *     @author Raj Gaurav
    public class SpecialCharacterDialog extends JDialog{
         String collectionString[] = null;
         ImageIcon suite[] = null;
         public SpecialCharacterDialog() {
              Container contentPane = getContentPane();
              //     Create the Table Model and create the Table from the model
              MyTableModel model = new MyTableModel();
              JTable table = new JTable(model);
              table.setDefaultRenderer(ImageIcon.class, new CustomCellRenderer());
              table.setCellSelectionEnabled(true);
              table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ListSelectionModel rowSM = table.getSelectionModel();
    rowSM.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
    //Ignore extra messages.
    if (e.getValueIsAdjusting()) return;
    ListSelectionModel lsm = (ListSelectionModel)e.getSource();
    if (lsm.isSelectionEmpty()) {
    System.out.println("No rows are selected.");
    } else {
    int selectedRow = lsm.getMinSelectionIndex();
    System.out.println("Row " + selectedRow
    + " is now selected.");
              //     Add the table to the contentPane
              JScrollPane pane = new JScrollPane(table);
              contentPane.add(pane);
    *     This class contains all the DATA information, the ImageIcons
    *     needed for display.
    class SymbolCollection {
         final static int NUMBER_OF_COLUMNS = 15;
         private String collectionString[] = null;
         private ImageIcon suite[] = null;
         *     Constructor : Initialises all the ImageIcon and their Names.
         public SymbolCollection() {
              File f = new File("C:\\Test\\Images");
              collectionString = f.list();
              int numberOfImages = collectionString.length;
              suite = new ImageIcon[numberOfImages];
              for(int i = 0;i < numberOfImages; i++) {
                   suite[i] = new ImageIcon("C:\\Test\\images" + File.separator + collectionString);
         *     Returns the total number of images in "images" folder.
         public int getTotalNumberOfImages() {
              return suite.length;
         *     Returns the target ImageIcon.
         public ImageIcon getImageIconAt(int number) {
              return suite[number];
         *     Returns the target ImageIcon Name.
         public String getImageIconNameAt(int number) {
              return collectionString[number];
         *     Returns an array of ALL the ImageIcons available.
         public ImageIcon[] getImageIcons() {
              return suite;
         *     Returns an array of ALL the ImageIcon names available
         public String[] getImageIconNames() {
              return collectionString;
         *     Returns TRUE for all cells
         public boolean isEditable(int row, int col) {
              return true;
    *     Defines the table model for the tabel.
    class MyTableModel extends AbstractTableModel {
         private SymbolCollection collection = null;
         private Object data[][] = null;
         *     Constructor for the TableModel. Initialises the "data" field for table.
         public MyTableModel() {
              int countOfImages = 0;
              collection = new SymbolCollection();
              data = new Object[getRowCount()][SymbolCollection.NUMBER_OF_COLUMNS];
              for(int i = 0; i < getRowCount(); i++) {
                   for(int j = 0; j < SymbolCollection.NUMBER_OF_COLUMNS; j++) {
                        if(countOfImages == collection.getTotalNumberOfImages()) {
                             break;
                        data[i][j] = collection.getImageIconAt(countOfImages);
                        countOfImages++;
         *     Returns the number of rows for this table.
         *     It is calculated as : TotalNumber/NumberOfColumns if remainder is ZERO or,
         *                              TotalNumber/NumberOfColumns + 1 if not.
         public int getRowCount() {
              int numberOfRows = collection.getTotalNumberOfImages()/SymbolCollection.NUMBER_OF_COLUMNS;
              if(numberOfRows == 0) {
                   return numberOfRows;
              else {
                   return numberOfRows + 1;
         *     Returns the number of Columns for this table
         public int getColumnCount() {
              return SymbolCollection.NUMBER_OF_COLUMNS;
         *     Returns the CLASS data type for this table
         public Class getColumnClass(int col) {
              return collection.getImageIconAt(0).getClass();
         *     Returns the table data at (row, col).
         public Object getValueAt(int row, int col) {
              return data[row][col];
    *     Renders the table to display images in individual cells
    class CustomCellRenderer extends JLabel implements TableCellRenderer {
         public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
              setIcon((ImageIcon)value);
              return this;

  • Hello all together  I have problems uploading photos in Illustrator CS6.  I can not resize it free.  can someone help me there or tell me where I have to apply?

    Hello
    I have problems uploading photos in Illustrator CS6.
    I can not resize it free.
    can someone help me there or tell me where I have to apply?

    Steve,
    I did say, and mean,
    I rustier in German than Steve may be ~ I may be rustier in German than Steve.
    inspired by the German word order, or the little green guy with the long ears, or something.
    French is quite a bit further down my language list (limited to small bits), the main source of understanding/recognizing being the corresponding loan words in English.
    At least some years ago I could read and understand all the half/full page German sentences effortlessly, but even then I was banned from helping our kids with any German homework.

  • I have a macbook pro version 10.7.5 and my mailbox will not open at all and comes up with a quit message even though it is not open. how can i get into my account. it works on my iPhone an i have internet and all other functions working on my computer

    I have a macbook pro version 10.7.5 and my mailbox will not open at all and comes up with a quit message even though it is not open. how can i get into my account. it works on my iPhone and i have internet and all other functions working on my computer

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the name of the crashed application or process in the Filter text field. Select the messages from the time of the last crash, if any. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    In the Console window, look under User Diagnostic Reports (not "Diagnostic and Usage Messages") for crash reports related to the crashed process. The report name starts with the name of the process, and ends with ".crash". Select the most recent report and post the entire contents—the text, not a screenshot. I know the report is long. Please post all of it anyway.
    In the interest of privacy, I suggest that, before posting, you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if it’s present (it may not be.)
    Please don’t post other kinds of diagnostic report—they're very long and rarely helpful.

  • Using multiple desktops with a 4 finger swipe on a Mac Book Pro running Lion- is there a way that I can allow Safari open on several but not all??  Looks like I can set it for one but not others.  All, one, or nothing

    Using multiple desktops with a 4 finger swipe on a Mac Book Pro running Lion- is there a way that I can allow Safari open on several but not all??  Looks like I can set it for one but not others.  All, one, or nothing

    Hey Eric,
    Thanks for taking the time. Unfortunately no that does not solve it. Same as swipe it will get me there and it will show separate programs spaced out. The issue I am having is that all my open word files are bunched up in a pile on top of each other. I can see the edges of each one but I want them to be separated from each other enough that I can visually identify what file is what.
    Again, thanks for trying, it is appreciated.

  • I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

    I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

    I created a slide show in imovie for my daughters 21st with voice overs from friends and family which was all working fine but now the voice recordings are not playing at all.  Obviously some setting has changed but I can't find which one.

  • My New Tab Page does not work at all. I just have the empty squares with nothing in them at all?

    My New Tab Page does not work at all. I just have the empty squares with nothing in them at all?
    I know how to use about:config & have had the usual problems with newtab page tiles but this is more like a bug- using 33.0.1. Doesn't show tiles icon in top right corner just shows a gear that is used to hide the empty tiles that I can't fill with sites. First it would only show 2 rows of 4 columns even though I had it set to 5 & 6 then few days later for no reason they went empty with a serrated line around the tiles & can't drag from the bookmarks---- really bloody annoying!!!!!!! Possibly a setting in the about:config but i can't fig it out?

    Reset Firefox to its default state
    If you're having major problems which you can't resolve, start fresh with only your essential information.
    Troubleshooting Information
    This page contains technical information that might be useful when you're trying to solve a problem. If you are looking for answers to common questions about Firefox, check out our support website.
    Application Basics
    Name Firefox
    Version 33.0.1
    Update History
    User Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
    Profile Folder
    Enabled Plugins about:plugins
    Build Configuration about:buildconfig
    Memory Use about:memory
    Multiprocess Windows 0/1
    Crash Reports for the Last 3 Days
    Report ID Submitted
    All Crash Reports
    Extensions
    Name Version Enabled ID
    Adblock Plus 2.6.5 true {d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}
    Adblock Plus Pop-up Addon 0.9.2 true [email protected]
    Skype Click to Call 7.3.16540.9015 true {82AF8DCA-6DE9-405D-BD5E-43525BDAD38A}
    Trend Micro BEP Firefox Extension 8.0.0.1173 true [email protected]
    Trend Micro NSC Firefox Extension 6.8.0.1120 true {22C7F6C6-8D67-4534-92B5-529A0EC09405}
    Trend Micro Toolbar 7.0.0.1243 true {22181a4d-af90-4ca3-a569-faed9118d6bc}
    Graphics
    Adapter Description Intel(R) HD Graphics
    Adapter Drivers igdumd64 igd10umd64 igdumdx32 igd10umd32
    Adapter RAM Unknown
    Device ID 0x0046
    Direct2D Enabled true
    DirectWrite Enabled true (6.2.9200.16571)
    Driver Date 1-30-2013
    Driver Version 8.15.10.2993
    GPU #2 Active false
    GPU Accelerated Windows 1/1 Direct3D 11 (OMTC)
    Vendor ID 0x8086
    WebGL Renderer Google Inc. -- ANGLE (Intel(R) HD Graphics Direct3D9Ex vs_3_0 ps_3_0)
    windowLayerManagerRemote true
    AzureCanvasBackend direct2d
    AzureContentBackend direct2d
    AzureFallbackCanvasBackend cairo
    AzureSkiaAccelerated 0
    Important Modified Preferences
    Name Value accessibility.blockautorefresh true
    accessibility.typeaheadfind.flashBar 0
    browser.cache.disk.capacity 358400
    browser.cache.disk.smart_size_cached_value 358400
    browser.cache.disk.smart_size.first_run false
    browser.cache.disk.smart_size.use_old_max false
    browser.cache.frecency_experiment 1
    browser.places.smartBookmarksVersion 7
    browser.sessionstore.upgradeBackup.latestBuildID 20141023194920
    browser.startup.homepage www.google.com
    browser.startup.homepage_override.buildID 20141023194920
    browser.startup.homepage_override.mstone 33.0.1
    browser.tabs.loadInBackground false
    dom.mozApps.used true
    extensions.lastAppVersion 33.0.1
    font.internaluseonly.changed true
    gfx.direct3d.last_used_feature_level_idx 1
    keyword.URL http://www.bing.com/search?FORM=UP97DF&PC=UP97&q=
    media.gmp-gmpopenh264.lastUpdate 1413750166
    media.gmp-gmpopenh264.version 1.1
    media.gmp-manager.lastCheck 1414375733
    network.cookie.prefsMigrated true
    places.database.lastMaintenance 1414404204
    places.history.expiration.transient_current_max_pages 102059
    plugin.disable_full_page_plugin_for_types application/pdf
    plugin.importedState true
    plugin.state.npmedia 0
    plugin.state.nptimegrid 1
    print.printer_Canon_MG2100_series_Printer.print_bgcolor false
    print.printer_Canon_MG2100_series_Printer.print_bgimages false
    print.printer_Canon_MG2100_series_Printer.print_colorspace
    print.printer_Canon_MG2100_series_Printer.print_command
    print.printer_Canon_MG2100_series_Printer.print_downloadfonts false
    print.printer_Canon_MG2100_series_Printer.print_duplex 3997817
    print.printer_Canon_MG2100_series_Printer.print_edge_bottom 0
    print.printer_Canon_MG2100_series_Printer.print_edge_left 0
    print.printer_Canon_MG2100_series_Printer.print_edge_right 0
    print.printer_Canon_MG2100_series_Printer.print_edge_top 0
    print.printer_Canon_MG2100_series_Printer.print_evenpages true
    print.printer_Canon_MG2100_series_Printer.print_footercenter
    print.printer_Canon_MG2100_series_Printer.print_footerleft &PT
    print.printer_Canon_MG2100_series_Printer.print_footerright &D
    print.printer_Canon_MG2100_series_Printer.print_headercenter
    print.printer_Canon_MG2100_series_Printer.print_headerleft &T
    print.printer_Canon_MG2100_series_Printer.print_headerright &U
    print.printer_Canon_MG2100_series_Printer.print_in_color true
    print.printer_Canon_MG2100_series_Printer.print_margin_bottom 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_left 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_right 0.5
    print.printer_Canon_MG2100_series_Printer.print_margin_top 0.5
    print.printer_Canon_MG2100_series_Printer.print_oddpages true
    print.printer_Canon_MG2100_series_Printer.print_orientation 0
    print.printer_Canon_MG2100_series_Printer.print_page_delay 50
    print.printer_Canon_MG2100_series_Printer.print_paper_data 1
    print.printer_Canon_MG2100_series_Printer.print_paper_height 11.00
    print.printer_Canon_MG2100_series_Printer.print_paper_name
    print.printer_Canon_MG2100_series_Printer.print_paper_size_type 0
    print.printer_Canon_MG2100_series_Printer.print_paper_size_unit 0
    print.printer_Canon_MG2100_series_Printer.print_paper_width 8.50
    print.printer_Canon_MG2100_series_Printer.print_plex_name
    print.printer_Canon_MG2100_series_Printer.print_resolution 7602290
    print.printer_Canon_MG2100_series_Printer.print_resolution_name
    print.printer_Canon_MG2100_series_Printer.print_reversed false
    print.printer_Canon_MG2100_series_Printer.print_scaling 1.00
    print.printer_Canon_MG2100_series_Printer.print_shrink_to_fit true
    print.printer_Canon_MG2100_series_Printer.print_to_file false
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_bottom 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_left 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_right 0
    print.printer_Canon_MG2100_series_Printer.print_unwriteable_margin_top 0
    privacy.sanitize.migrateFx3Prefs true
    privacy.sanitize.timeSpan 2
    storage.vacuum.last.index 1
    storage.vacuum.last.places.sqlite 1412311800
    Important Locked Preferences
    Name Value
    JavaScript
    Incremental GC true
    Accessibility
    Activated false
    Prevent Accessibility 0
    Library Versions
    Expected minimum version Version in use
    NSPR 4.10.7 4.10.7
    NSS 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSSMIME 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSSSL 3.17.1 Basic ECC 3.17.1 Basic ECC
    NSSUTIL 3.17.1 3.17.1
    Experimental Features
    Name ID Description Active End Date Homepage

Maybe you are looking for

  • A better way to run .FMX from hyperlink

    Dear all, I am finding ways to execute .FMX from hyperlink in HTML. I tried to create a shortcut file (.LNK) that runs the .FMX and then using a hyperlink to refer that shortcut file. However, the browser prompts me for whether to run or to save the

  • Doubt in ABAP function

    Hi, I have a doubt in one of the abap function module i use. This contain code to retrieve ,update and delete and create values in table. I am using this function  module to retrieve ,update and delete and create values in table.  This is the ABAP co

  • Garbled playback and can't uncheck hardware acceleration

    I have the latest version of flash player on a macbook with mountain lion. i have garbled, green video playback, and after searching the web for about an hour it looks like it has something to do with hardware acceleration being turned on. when I rig

  • HT1338 I can't activate my iphone

    Dear Sir, Kindly help me to activate my iPhone 3G as I can't activate my iPhone cause of the activation server is unavailable, what I have to do? Best Regards, Youssef

  • Fetch XML from Content server to Portlet and display as HTML

    Hi, I want to fetch the XML from the content server and display that XML in the Weblogic Portlet as HTML. The main reason is that data will be contributed by the users in UCM and then I had to get that data from content server and display in portlet