Problem in adding image to a frame.

Hi,
I am trying to add an image to a frame as follows:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
class introFrame extends JFrame
     private Image image;
     public introFrame()
          setUndecorated(true);
          image = Toolkit.getDefaultToolkit().getImage("triplesIcon.gif");
          MediaTracker tracker = new MediaTracker(this);
          tracker.addImage(image, 0);
          try
               tracker.waitForID(0);
          catch (InterruptedException exception)
          setBounds(100,100,600,400);
          Container contentPane = getContentPane();
          contentPane.setBackground(Color.white);
          show();
     public void paintComponents(Graphics g)
          super.paintComponents(g);
          g.drawImage(image, 20, 20, null);
But it is not showing the image. The image and the class is in the same folder.
Please suggest me the solution.

import java.awt.*;
import java.awt.event.*;
import java.net.*;
import javax.swing.*;
public class Example {
    public static void main(String[] args) throws MalformedURLException {
        URL url = new URL("http://today.java.net/jag/bio/JagHeadshot-small.jpg");
        JLabel label = new JLabel(new ImageIcon(url));
        label.addMouseListener(new MouseAdapter(){
            public void mousePressed(MouseEvent e) {
                if (e.getClickCount() > 1)
                    System.exit(0);
        JFrame f = new JFrame("Example");
        f.setUndecorated(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.getContentPane().add(label);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);
}

Similar Messages

  • Problem in adding image in jtable cells

    hi all.
    im creating a swing application using netbeans 6.0.
    i want to display image in cells of one column.
    for that i set an "image icon" directly to that cell in the "default table model", in that case it is displaying the path of that image in that cell!
    then i created a new label, and set the image as icon of that label. added that label in that cell. in this case it is printing label.tostring() to that cell!!
    please help.
    thanks in advance.

    You need to override getColumnClass to return Icon.class for the column containing the icon. A code snippet that demonstrates how you might do this:      table = new JTable (new DefaultTableModel (data, colNames) {
             public Class getColumnClass (int columnIndex) {
                switch (columnIndex) {
                   case 0: return Calendar.class;
                   case 1: return String.class;
                   case 2: return Icon.class;
                   //case 2: return Boolean.class;
                return null;
          });luck, db

  • Problem in adding images to Web Intelligence

    Post Author: beginner~~
    CA Forum: WebIntelligence Reporting
    Dear all,
    I'm trying to insert an image back to my WI report since the pictures in my DI report are disappeared. And I've found this help
    "Note: Image files need to installed by your administrator at the following directory on the BusinessObjects Enterprise server: <INSTALL DIR>\"
    from the documentation "xir2_wi_analysis_en.pdf" (Pg. 100)
    May I know what's the <INSTALL DIR>? And how can I upload my images to this folder and what actions do I have to take? Thanks a lot.
    Best Regards,

    Only if you use a separate FTP Client and just overwrite the originals with the Sharpened ones. Make sure you are replacing the correct ones or doing them all. Most Galleries from LR generate two or three Sizes.
    Don
    Don Ricklin, MacBook 2Ghz Duo 2 Core running 10.5.1 & Win XP, Pentax *ist D See LR Links list at http://donricklin.blogspot.com for related sites.

  • Adding images and buttons without a frame appearing

    I would like to add images to some of my pages without having them appear in a frame. I would like to place some transparent gifs on the page to use as buttons for hyperlinks. I would also like to have some photos (with transparent backgrounds that appear on the page and are not surrounded by a picture frame. Any Suggestions

    iWeb seems to default to stroking newly-added images and shapes. Pages (iWeb's close relation) includes a way to change the default appearance, but I can't find anything similar in iWeb. You can, of course, remove the stroke using the Graphic Inspector (just set Stroke to None). Transparency in gifs and photo images is supported. Just drag into iWeb or use Insert > Choose... Again, remove the stroke if this appears.

  • Adding Image problems

    Having some problems adding images.
    I was able to add the Ubuntu server image mentioned in the install guide and it is working 
    It appears on the nodes palette and I can create a topology with it and boot it.
    I was also able to add CSR image csr1000v-universalk9.03.13.00a.S.154-3.S0a-ext.qcow2 to the server.  
    However the CSR icon isn't available on the node palette.  How do I fix this?
    How to add other vmdk or ovf style images?  
    I have a network emulator that runs as a VM and comes as a vmdk.   I tried installing it and I get the following message ...  -Cannot create image "server-DummyCloud": Failed to convert image to QCOW2: Command '['qemu-img', 'convert', '-O', 'qcow2', '/tmp/tmpnfp_m_', '/tmp/tmpWk3al7']' returned non-zero exit status 1
    Where can I find compatible NXos images?  

    No change.
    Still get the message ..
    Cannot create image "server-DummyCloud": Failed to convert image to QCOW2: Command '['qemu-img', 'convert', '-O', 'qcow2', '/home/virl/dc.vmdk', '/tmp/tmpmgCkzK']' returned non-zero exit status 1
    I"ll open a tac case.

  • Add Image Sequence default frame rate

    Compresssor 3.5 appears to default to 24 fps when adding image sequences to the batch.
    Is it possible to change this default to 23.98 fps in a plist somewhere? I deal almost exclusively in 23.98 material so having to change this for EVERY image sequence I process is a pain.
    -Matt

    I'll try to re-formulate (I'm sorry, english is not my native language).
    What I do in Compressor:
    1) I import my image sequence
    2) set it at 25fps in the image sequence settings
    3) choose prores 25fps export (I created a prores preset at 25fps, as you suggested)
    And the resulting clip is okay.
    BUT
    I have many image sequences and it's too slow to manually interpret every one of them at 25fps. The problem is in point 2). Because there's no way to interpret all the image sequences at 25fps with just one click for all.
    I think it's the same with quicktime: you have to import every single image sequence, select the frame rate, export... one at a time.
    I will have a look at mpeg streamclip.
    thanks for answers

  • JTable sorting - problem when adding elements (complete code inside)

    I�m writing this email with reference to a recent posting here but this time with the code example. (I apologize for the duplicated posting � this time it will be with the code)
    Problem: when adding more elements to the JTable (sorted) the exception: ArrayIndexOutOfBoundsException is thrown.
    Example: If the elements in the table are 10 and then the user requests for 8 � the table will produce the correct result. However, if the user will ask for 11 items (>10) the exception will be thrown.
    The program: The program below (compiles and running). A JTable is constructed with 3 items, when you click the button - the return result should be 4 items - this will generate the error, WHY?
    I would highly appreciate your thoughts why this is happening and most importantly � how to fix it.
    Thanks a lot
    3 files:
    (1) TableSorterDemo
    (2) Traveler
    (3)TableSorter
    //TableSorterDemo:
    package sorter;
    import javax.swing.DefaultListModel;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.table.AbstractTableModel;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    * TableSorterDemo is like TableDemo, except that it
    * inserts a custom model -- a sorter -- between the table
    * and its data model.  It also has column tool tips.
    public class TableSorterDemo implements ActionListener
         private JPanel superPanel;
         private JButton clickMe = new JButton("click me to get diff data");
         private boolean DEBUG = false;
         private DefaultListModel defaultListModel;
         private JTable table;
        public TableSorterDemo()
             superPanel = new JPanel(new BorderLayout());
             defaultListModel = new DefaultListModel();
             init1();
            TableSorter sorter = new TableSorter(new MyTableModel(defaultListModel)); //ADDED THIS     
            table = new JTable(sorter);             //NEW
            sorter.setTableHeader(table.getTableHeader()); //ADDED THIS
            table.setPreferredScrollableViewportSize(new Dimension(500, 70));
            //Set up tool tips for column headers.
            table.getTableHeader().setToolTipText(
                    "Click to specify sorting; Control-Click to specify secondary sorting");
            //Create the scroll pane and add the table to it.
            JScrollPane scrollPane = new JScrollPane(table);
            //Add the scroll pane to this panel.
            superPanel.add("Center", scrollPane);
            superPanel.add("South",clickMe);
            clickMe.addActionListener(this);              
        public JPanel getPanel()
             return superPanel;
        public void init1()
             //in real life this will be done from the db
             Traveler a = new Traveler();
             Traveler b = new Traveler();
             Traveler c = new Traveler();
             a.setFirstName("Elvis");
             a.setLastName("Presley");
             a.setSprot("Ping Pong");
             a.setNumYears(3);
             a.setVegetarian(true);
             b.setFirstName("Elton");
             b.setLastName("John");
             b.setSprot("Soccer");
             b.setNumYears(2);
             b.setVegetarian(true);
             c.setFirstName("shaquille");
             c.setLastName("oneil");
             c.setSprot("Golf");
             c.setNumYears(22);
             c.setVegetarian(true);
             defaultListModel.addElement(a);
             defaultListModel.addElement(b);
             defaultListModel.addElement(c);
        public void init2()
             //in real life this will be done from the db
             Traveler d = new Traveler();
             Traveler e = new Traveler();
             Traveler f = new Traveler();
             Traveler g = new Traveler();
             d.setFirstName("John");
             d.setLastName("Smith");
             d.setSprot("Tennis");
             d.setNumYears(32);
             d.setVegetarian(true);
             e.setFirstName("Ron");
             e.setLastName("Cohen");
             e.setSprot("Baseball");
             e.setNumYears(12);
             e.setVegetarian(true);
             f.setFirstName("Donald");
             f.setLastName("Mac Novice");
             f.setSprot("Vallyball");
             f.setNumYears(1);
             f.setVegetarian(true);
             g.setFirstName("Eithan");
             g.setLastName("Superstar");
             g.setSprot("Vallyball");
             g.setNumYears(21);
             g.setVegetarian(true);
             defaultListModel.addElement(d);
             defaultListModel.addElement(e);
             defaultListModel.addElement(f);
             defaultListModel.addElement(g);            
        class MyTableModel extends AbstractTableModel
             private DefaultListModel myModel;
             public MyTableModel(DefaultListModel m)
                  myModel=m;
            private String[] columnNames = {"First Name",
                                            "Last Name",
                                            "Sport",
                                            "# of Years",
                                            "Vegetarian"};
            public int getColumnCount()
                return columnNames.length;
            public int getRowCount()
                return myModel.size();
            public String getColumnName(int column)
                 return getNames()[column];             
             public String[] getNames()
                  String[] names = {"First Name", "Last Name", "Sport", "# of Years", "Vegetarian"};
                  return names;
            public Object getValueAt(int row, int col)
                 return distributeObjectsInTable(row, col, (Traveler) myModel.elementAt(row));
            public Object distributeObjectsInTable(int row, int col, Traveler tr)
               switch(col)
                         case 0:
                              return tr.getFirstName();
                         case 1:
                           return tr.getLastName();
                      case 2:
                           return tr.getSprot();
                      case 3:
                           return new Integer(tr.getNumYears());
                      case 4:
                           return new Boolean (tr.isVegetarian());
                     default:
                         return "Error";
            public Class getColumnClass(int c)
                return getValueAt(0, c).getClass();
        private static void createAndShowGUI()
            //Make sure we have nice window decorations.
            JFrame.setDefaultLookAndFeelDecorated(true);
            //Create and set up the window.
            JFrame frame = new JFrame("TableSorterDemo");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            //Create and set up the content pane.
            TableSorterDemo newContentPane = new TableSorterDemo();
            newContentPane.getPanel().setOpaque(true); //content panes must be opaque
            frame.setContentPane(newContentPane.getPanel());
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        public static void main(String[] args)
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable()                   
                public void run()
                    createAndShowGUI();
         public void actionPerformed(ActionEvent ae)
              if (ae.getSource()==clickMe)
                   defaultListModel.removeAllElements();
                   init2(); //if the size of the model was less than 2 items - the result will be ok.
                              //in other words, if you commens the last 2 rows of this method (addElement(f) & g)
                             // the result will be fine.
                   table.updateUI();          
    }//(2) Traveler
    package sorter;
    public class Traveler
         private String firstName;
         private String lastName;
         private String sprot;
         private int numYears;
         private boolean vegetarian;
         public String getFirstName()
              return firstName;
         public String getLastName()
              return lastName;
         public int getNumYears()
              return numYears;
         public String getSprot()
              return sprot;
         public boolean isVegetarian()
              return vegetarian;
         public void setFirstName(String firstName)
              this.firstName = firstName;
         public void setLastName(String lastName)
              this.lastName = lastName;
         public void setNumYears(int numYears)
              this.numYears = numYears;
         public void setSprot(String sprot)
              this.sprot = sprot;
         public void setVegetarian(boolean vegetarian)
              this.vegetarian = vegetarian;
    }//(3)TableSorter
    package sorter;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.util.List;
    import javax.swing.*;
    import javax.swing.event.TableModelEvent;
    import javax.swing.event.TableModelListener;
    import javax.swing.table.*;
    public class TableSorter extends AbstractTableModel {
        protected TableModel tableModel;
        public static final int DESCENDING = -1;
        public static final int NOT_SORTED = 0;
        public static final int ASCENDING = 1;
        private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);
        public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {
            public int compare(Object o1, Object o2) {
                return ((Comparable) o1).compareTo(o2);
        public static final Comparator LEXICAL_COMPARATOR = new Comparator() {
            public int compare(Object o1, Object o2) {
                return o1.toString().compareTo(o2.toString());
        private Row[] viewToModel;
        private int[] modelToView;
        private JTableHeader tableHeader;
        private MouseListener mouseListener;
        private TableModelListener tableModelListener;
        private Map columnComparators = new HashMap();
        private List sortingColumns = new ArrayList();
        public TableSorter() {
            this.mouseListener = new MouseHandler();
            this.tableModelListener = new TableModelHandler();
        public TableSorter(TableModel tableModel) {
            this();
            setTableModel(tableModel);
        public TableSorter(TableModel tableModel, JTableHeader tableHeader) {
            this();
            setTableHeader(tableHeader);
            setTableModel(tableModel);
        private void clearSortingState() {
            viewToModel = null;
            modelToView = null;
        public TableModel getTableModel() {
            return tableModel;
        public void setTableModel(TableModel tableModel) {
            if (this.tableModel != null) {
                this.tableModel.removeTableModelListener(tableModelListener);
            this.tableModel = tableModel;
            if (this.tableModel != null) {
                this.tableModel.addTableModelListener(tableModelListener);
            clearSortingState();
            fireTableStructureChanged();
        public JTableHeader getTableHeader() {
            return tableHeader;
        public void setTableHeader(JTableHeader tableHeader) {
            if (this.tableHeader != null) {
                this.tableHeader.removeMouseListener(mouseListener);
                TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();
                if (defaultRenderer instanceof SortableHeaderRenderer) {
                    this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);
            this.tableHeader = tableHeader;
            if (this.tableHeader != null) {
                this.tableHeader.addMouseListener(mouseListener);
                this.tableHeader.setDefaultRenderer(
                        new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));
        public boolean isSorting() {
            return sortingColumns.size() != 0;
        private Directive getDirective(int column) {
            for (int i = 0; i < sortingColumns.size(); i++) {
                Directive directive = (Directive)sortingColumns.get(i);
                if (directive.column == column) {
                    return directive;
            return EMPTY_DIRECTIVE;
        public int getSortingStatus(int column) {
            return getDirective(column).direction;
        private void sortingStatusChanged() {
            clearSortingState();
            fireTableDataChanged();
            if (tableHeader != null) {
                tableHeader.repaint();
        public void setSortingStatus(int column, int status) {
            Directive directive = getDirective(column);
            if (directive != EMPTY_DIRECTIVE) {
                sortingColumns.remove(directive);
            if (status != NOT_SORTED) {
                sortingColumns.add(new Directive(column, status));
            sortingStatusChanged();
        protected Icon getHeaderRendererIcon(int column, int size) {
            Directive directive = getDirective(column);
            if (directive == EMPTY_DIRECTIVE) {
                return null;
            return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));
        private void cancelSorting() {
            sortingColumns.clear();
            sortingStatusChanged();
        public void setColumnComparator(Class type, Comparator comparator) {
            if (comparator == null) {
                columnComparators.remove(type);
            } else {
                columnComparators.put(type, comparator);
        protected Comparator getComparator(int column) {
            Class columnType = tableModel.getColumnClass(column);
            Comparator comparator = (Comparator) columnComparators.get(columnType);
            if (comparator != null) {
                return comparator;
            if (Comparable.class.isAssignableFrom(columnType)) {
                return COMPARABLE_COMAPRATOR;
            return LEXICAL_COMPARATOR;
        private Row[] getViewToModel() {
            if (viewToModel == null) {
                int tableModelRowCount = tableModel.getRowCount();
                viewToModel = new Row[tableModelRowCount];
                for (int row = 0; row < tableModelRowCount; row++) {
                    viewToModel[row] = new Row(row);
                if (isSorting()) {
                    Arrays.sort(viewToModel);
            return viewToModel;
        public int modelIndex(int viewIndex)
            return getViewToModel()[viewIndex].modelIndex;
        private int[] getModelToView()
            if (modelToView == null) {
                int n = getViewToModel().length;
                modelToView = new int[n];
                for (int i = 0; i < n; i++) {
                    modelToView[modelIndex(i)] = i;
            return modelToView;
        // TableModel interface methods
        public int getRowCount() {
            return (tableModel == null) ? 0 : tableModel.getRowCount();
        public int getColumnCount() {
            return (tableModel == null) ? 0 : tableModel.getColumnCount();
        public String getColumnName(int column) {
            return tableModel.getColumnName(column);
        public Class getColumnClass(int column) {
            return tableModel.getColumnClass(column);
        public boolean isCellEditable(int row, int column) {
            return tableModel.isCellEditable(modelIndex(row), column);
        public Object getValueAt(int row, int column) {
            return tableModel.getValueAt(modelIndex(row), column);
        public void setValueAt(Object aValue, int row, int column) {
            tableModel.setValueAt(aValue, modelIndex(row), column);
        // Helper classes
        private class Row implements Comparable {
            private int modelIndex;
            public Row(int index) {
                this.modelIndex = index;
            public int compareTo(Object o) {
                int row1 = modelIndex;
                int row2 = ((Row) o).modelIndex;
                for (Iterator it = sortingColumns.iterator(); it.hasNext();) {
                    Directive directive = (Directive) it.next();
                    int column = directive.column;
                    Object o1 = tableModel.getValueAt(row1, column);
                    Object o2 = tableModel.getValueAt(row2, column);
                    int comparison = 0;
                    // Define null less than everything, except null.
                    if (o1 == null && o2 == null) {
                        comparison = 0;
                    } else if (o1 == null) {
                        comparison = -1;
                    } else if (o2 == null) {
                        comparison = 1;
                    } else {
                        comparison = getComparator(column).compare(o1, o2);
                    if (comparison != 0) {
                        return directive.direction == DESCENDING ? -comparison : comparison;
                return 0;
        private class TableModelHandler implements TableModelListener {
            public void tableChanged(TableModelEvent e) {
                // If we're not sorting by anything, just pass the event along.            
                if (!isSorting()) {
                    clearSortingState();
                    fireTableChanged(e);
                    return;
                // If the table structure has changed, cancel the sorting; the            
                // sorting columns may have been either moved or deleted from            
                // the model.
                if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {
                    cancelSorting();
                    fireTableChanged(e);
                    return;
                // We can map a cell event through to the view without widening            
                // when the following conditions apply:
                // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,
                // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,
                // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,
                // d) a reverse lookup will not trigger a sort (modelToView != null)
                // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.
                // The last check, for (modelToView != null) is to see if modelToView
                // is already allocated. If we don't do this check; sorting can become
                // a performance bottleneck for applications where cells 
                // change rapidly in different parts of the table. If cells
                // change alternately in the sorting column and then outside of            
                // it this class can end up re-sorting on alternate cell updates -
                // which can be a performance problem for large tables. The last
                // clause avoids this problem.
                int column = e.getColumn();
                if (e.getFirstRow() == e.getLastRow()
                        && column != TableModelEvent.ALL_COLUMNS
                        && getSortingStatus(column) == NOT_SORTED
                        && modelToView != null) {
                    int viewIndex = getModelToView()[e.getFirstRow()];
                    fireTableChanged(new TableModelEvent(TableSorter.this,
                                                         viewIndex, viewIndex,
                                                         column, e.getType()));
                    return;
                // Something has happened to the data that may have invalidated the row order.
                clearSortingState();
                fireTableDataChanged();
                return;
        private class MouseHandler extends MouseAdapter {
            public void mouseClicked(MouseEvent e) {
                JTableHeader h = (JTableHeader) e.getSource();
                TableColumnModel columnModel = h.getColumnModel();
                int viewColumn = columnModel.getColumnIndexAtX(e.getX());
                int column = columnModel.getColumn(viewColumn).getModelIndex();
                if (column != -1) {
                    int status = getSortingStatus(column);
                    if (!e.isControlDown()) {
                        cancelSorting();
                    // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or
                    // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.
                    status = status + (e.isShiftDown() ? -1 : 1);
                    status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}
                    setSortingStatus(column, status);
        private static class Arrow implements Icon {
            private boolean descending;
            private int size;
            private int priority;
            public Arrow(boolean descending, int size, int priority) {
                this.descending = descending;
                this.size = size;
                this.priority = priority;
            public void paintIcon(Component c, Graphics g, int x, int y) {
                Color color = c == null ? Color.GRAY : c.getBackground();            
                // In a compound sort, make each succesive triangle 20%
                // smaller than the previous one.
                int dx = (int)(size/2*Math.pow(0.8, priority));
                int dy = descending ? dx : -dx;
                // Align icon (roughly) with font baseline.
                y = y + 5*size/6 + (descending ? -dy : 0);
                int shift = descending ? 1 : -1;
                g.translate(x, y);
                // Right diagonal.
                g.setColor(color.darker());
                g.drawLine(dx / 2, dy, 0, 0);
                g.drawLine(dx / 2, dy + shift, 0, shift);
                // Left diagonal.
                g.setColor(color.brighter());
                g.drawLine(dx / 2, dy, dx, 0);
                g.drawLine(dx / 2, dy + shift, dx, shift);
                // Horizontal line.
                if (descending) {
                    g.setColor(color.darker().darker());
                } else {
                    g.setColor(color.brighter().brighter());
                g.drawLine(dx, 0, 0, 0);
                g.setColor(color);
                g.translate(-x, -y);
            public int getIconWidth() {
                return size;
            public int getIconHeight() {
                return size;
        private class SortableHeaderRenderer implements TableCellRenderer {
            private TableCellRenderer tableCellRenderer;
            public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) {
                this.tableCellRenderer = tableCellRenderer;
            public Component getTableCellRendererComponent(JTable table,
                                                           Object value,
                                                           boolean isSelected,
                                                           boolean hasFocus,
                                                           int row,
                                                           int column) {
                Component c = tableCellRenderer.getTableCellRendererComponent(table,
                        value, isSelected, hasFocus, row, column);
                if (c instanceof JLabel) {
                    JLabel l = (JLabel) c;
                    l.setHorizontalTextPosition(JLabel.LEFT);
                    int modelColumn = table.convertColumnIndexToModel(column);
                    l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));
                return c;
        private static class Directive {
            private int column;
            private int direction;
            public Directive(int column, int direction) {
                this.column = column;
                this.direction = direction;
    }

    The table listens to the TableModel for changes. Changing the table by adding/removing
    rows or columns has no affect on its table model. If you make changes to the table model
    the table will be notified by its TableModelListener and change its view. So tell
    MyTableModel about the change of data:
    public class TableSorterDemo implements ActionListener
        MyTableModel tableModel;
        public TableSorterDemo()
            defaultListModel = new DefaultListModel();
            init1();
            tableModel = new MyTableModel(defaultListModel);
            TableSorter sorter = new TableSorter(tableModel);
        public void actionPerformed(ActionEvent ae)
            if (ae.getSource()==clickMe)
                defaultListModel.removeAllElements();
                init2();
                tableModel.fireTableStructureChanged();
    }

  • Apple have a big flaw adding images to Apple TV coding error.

    Hi all, it seems Apple have a big flaw in there new version of itunes 8.2.0.23.
    So heres the problem if you have a Apple Tv system. Adding images is great however the softwares flaw is when you have a lot of images. i have over 3000, and tick boxes apear half way in the list, for know reason.
    i have add a link to show you guys and girls a screen shot...
    can anyone from apple sort this out?
    it really bugging me. as it happens of vista, xp, windows 7, and osx.
    Cheers
    Adam
    null

    apple don't monitor the forums for bug reports... this is a user-to-user support forum.
    you should report it via the official method - http://www.apple.com/feedback/appletv.html

  • Problem in displaying images one by one in JList

    I have a problem in displaying images one by one in Jlist. I want to show 100 images as a thumbnailview in jlist but it is talking too much time to show all the images after scalling 100 images to thumbnail view and making it into ImageIcon. So, i thought that it would be better way to show one by one after scaling it into thumnailview. But my renderer is getting calling after 100 images scaled down and setting into list. I have posted my code 2 days back but there is no reply.
    http://forum.java.sun.com/thread.jspa?threadID=789943
    I donno where i am missing in this code.
    Plz suggest me some solution for it.

    Where is the scaling done? In the ListCellRenderer? Regardless of where that is being done, I assume you are caching the scaled images after you scale them, right? If not, consider adding some sort of caching.
    This should do the trick...
    Rework your ListCellRenderer to check to see if a scaled version of the image is available. If not, start a thread to do the scaling and create an ImageIcon. In the meantime, while that thread is running, have the renderer return some sort of stock icon, like a little generic image icon. When the scaling thread completes, make a call to repaint() on the JList so the cell renderer gets re-asked for the icons. This time around, the renderer should notice that a scaled version (the ImageIcon) is available. Return that. So, this method doesn't guarantee that the images will be produced in order, 1...2...3..., but it will return images as they become available, and the overall JList rendering won't wait until all 100 are ready. If you want them returned in order, just do all of the scaling in a single thread and queue up the images to be scaled, in order.
    I hoped this helps. (If it does, please throw me some Duke Dollars.)

  • Hello everybody, Problem with Two panel in a Frame

    This is my first mail in this forum.I'm trying to learn java myself & have a problem in adding more than one panel in a JFrame.
    i should be able to add one panel which occupies 3/4 of a frame and another panel occupies the rest.
    Thanx in advance for anyone who helps me in sorting out this problem.

    You can use for example the GridLayout
    In your JFrame constructor, add lines below, it will add 2 colored panel in your frame
    Container container = getContentPane();
    container.setLayout(new GridLayout(1,2)); // 1 row, 2 cols
    JPanel panel1 = new JPanel();
    panel1.setBackground(Color.red);
    container.add(panel1);
    JPanel panel2 = new JPanel();
    panel2.setBackground(Color.green);
    container.add(panel2);

  • Problem with ATV refresh rates and frame rates

    I live in Australia and as such I am subject to PAL, so when I set my ATV up I set it to 720P 50Hz, when I purchased a TV season the episodes were running at 25fps and played back flawlessly with no dropped or added frames. My problem occurs when I download movies, all the movies I have bought are running at 24fps and suffer from quite noticeable jitter, almost like the 24th frame is duplicated and added as the 25th frame, I assume it is something like this as the pause happens every second.
    So has anyone had a problem similar to this and if so what do you do about it?
    Does the ATV playback all sources (24/25) smoothly even if it has to convert?
    Could it be caused by my TV?
    Any help to any of these questions would be great.
    Thanks.
    Tim.

    With my particular Apple TV setup and TV combination, I find that setting to 1080p (60hZ) gives my the best all-round round results.
    This does result in -slightly- jerky motion with 25fps material (especially old British TV shows), but it's bearable. It's particularly noticeable with sideways scrolling text and credits.
    The one thing that is peculiar on my setup is if I use 720p (either @60hz or 50hz) and watch an iTunes-purchased HD episode that is encoded at 24fps I get very odd motion effects indeed. Every few seconds the video appears to speed up almost like it is 'catching up' with lost frames - very hard to explain exactly how it looks. Anyway I set to 1080p and this effect is gone completely. It also goes away if I set to 1080i. I think something queer is going on with 720p on the Apple TV (at least with my TV there is). This happens with both HDMI and component outputs.
    It may be worth trying 1080i at either 50 or 60Hz if your set can't do 1080p.
    I would also suggest that 60hz in theory should give a smoother motion for 24fps playback than 50Hz.
    My basic problem with all this is that on even a cheap DVD player if a disk is 50Hz, the player switches to 50Hz output and if it is 60Hz, it will change to 60Hz. The Apple TV stays fixed. It's a shame it can't autoswitch refresh rates.

  • Adding Image in Reports 10g

    I have added one image in existing Report to customize it.While seeing the utput in Applications it does not display the image.The format for the image is .jpg.We are using Applications R12,Reports 10g.How to get it.

    Hi ,
    Firstly sorry for asking in the same thread . .
    I am also working in the same envronment.
    my destination type is PDF and its a bitmap report.
    so my senario is something like this.
    I need to print the signature of the agent based on the agent id on all pages of the report.
    and each page it has to check the agent id and print the same .. we can issue the report to generate the o/p for multiple orders/so multiple agents. . . so
    1st page -> jack -> so his singature . ..
    2nd page -> Jack . . same order continues -> same signatuer repeats.
    3rd page -> scott -> so another signature . .
    issues:
    we have to print this in the footer of the page . . so we used the edit margin section for the same.
    we are actually picking up the agent id for that page using a summary column and function set to last and reset at page level.
    ( both the summary column and the formula colum are not in any group in the data model)
    we created a formula column for picking the image file properties below
    type: character
    read from file: yes
    file_type: image
    it actually works but the problem is the image starts from the second page onwards. and for 3 pages it prints . . .
    1st page -> blank - Jack's signature is req.
    2nd page - > jack's signature appears . .
    3rd page -> jack's signature -> should be scott's signature
    in case the fourth page for scott or any other person is ther e
    scott's signature appears . . .
    please guide me . . .
    thanks and regards
    Jagan.

  • Problems while accessing images outside the web document-root folder

    Our application runs on Oracle application server on Linux. Facing problems while accessing images outside the web document-root folder. This works with changes in global-web-application.xml by including the <virtual-directory> tag. The same change does not work when done on Linux machine. It is unable to find the image. Please help in resolving this issue.
    </locale-encoding-mapping>
    </locale-encoding-mapping-list>
    </web-app>
    <virtual-directory virtual-path="/img" real-path="/home/eposuat/" />
    </orion-web-app>
    Code in the jsp:
    <img width=700 height=700 src="/img/3.tif"></img>
    <img width=700 height=700 src="/img/WB.gif"></img>

    This is one of the least satisfactory aspects of site management in Dreamweaver, and several developers, including myself, have been pressuring the Dreamweaver team for some years to improve this. Who knows? They might eventually take notice.
    The only way to do this at the moment is to create two site definitions, one nested inside the other. Set up the site definition normally based on htdocs as your site root. Then create a new site definition based on site. Dreamweaver will nag you that it can cause problems, but it won't actually stop you from doing it. The only potential problem is with site synchronization.
    The problem with using site as the only basis for your site definition is that Dreamweaver automatically puts things like the Connections, Scripts, and other folders in the site root. So, everything ends up at the wrong level of the site hierarchy. Quite frankly, the whole thing is a bit of a pain. Dynamic site development was added to Dreamweaver only in version 6 (Dreamweaver MX), and no one had really thought through the need to store files outside the site root.

  • Problem creating several image maps (linking to different pdf files) RoboHelp 8

    Hi,
    I have a problem creating several image map hotspots (that link to different .pdf files), from the same image using RoboHelp 8 HTML (WebHelp project).
    After compiling, the first image map hotspot created, opens the .pdf file correctly.  Unfortunately, when clicking on the other image hotspots, I get an error " Cannot find file...<file path>... Make sure path or Internet address is correct".
    All the pdf documents are located in the same folder within the project.
    Can anyone help?

    Have you added the target files as baggage?
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Problems Displaying an Image in a TableCell

    I read a few tutorials online about adding images to a tableview tablecell and tried to implement what I learned from the tutorial, but I'm not having much luck. My problem is that the image is not being displayed in the table cell.
    The problem is in the getTable Method of the ExampleProblem class. I know that "item" in the updateItem method of the setCellFactory is null and I can figure out why. I'm having a hard time understanding the callback part of the setCellFactory, which is making it difficult to figure out where my problem is located and why it is happening.
    Hopefully, someone can help me out or at least point me in the right direction.
    Thanks in advance for any help.
    -Fred
    package whitman.fa.encounter;
    import javafx.application.Application;
    import javafx.beans.property.IntegerProperty;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleIntegerProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.property.SimpleStringProperty;
    import javafx.beans.property.StringProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    import javafx.geometry.Pos;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.TableCell;
    import javafx.scene.control.TableColumn;
    import javafx.scene.control.TableView;
    import javafx.scene.control.cell.PropertyValueFactory;
    import javafx.scene.effect.DropShadow;
    import javafx.scene.image.Image;
    import javafx.scene.image.ImageView;
    import javafx.scene.layout.BorderPane;
    import javafx.scene.layout.GridPane;
    import javafx.scene.layout.VBox;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.Rectangle;
    import javafx.scene.text.Font;
    import javafx.scene.text.Text;
    import javafx.stage.Stage;
    import javafx.util.Callback;
    public class ExampleProblem extends Application
      BorderPane rootLayout;
      ObservableList<Encounter> encounters = FXCollections.observableArrayList();
      ObservableList<MobPict> imgData = FXCollections.observableArrayList();
      Group root;
      Scene scene;
      GridPane pane;
      public ExampleProblem()
      imgData.addAll(new MobPict("Bugbear.jpg","Bugbear"), new MobPict("po_BGArcher_h.png", "PC"));
      encounters.addAll(
      new Encounter(1,5,1,1,"Bugbear",0,0,null,3,"Bestiary pg 75", imgData.get(0)),
      new Encounter(6,15,1,1,"PC",0,0,null,3,"HeroLabs",imgData.get(1))
      @Override
      public void start(Stage primaryStage) throws Exception
      primaryStage.setTitle("Table Test with image column");
      //Display TableView
      Group group = getBackground();
      VBox box = new VBox();
      box.setLayoutX(20);
      box.setLayoutY(5);
      box.setSpacing(15);
      Text text = new Text("Image Column test");
      text.setFont(new Font(20));
      TableView<Encounter> table = getTable();
      box.getChildren().addAll(text, table);
      group.getChildren().add(box);
      Scene scene = new Scene(group, 680,530,Color.web("#666666"));
      primaryStage.setScene(scene);
      primaryStage.show();
      public Group getBackground()
      Group group = new Group();
      group.setLayoutX(40);
      group.setLayoutY(40);
      Rectangle rect = new Rectangle();
      rect.setWidth(600);
      rect.setHeight(460);
      rect.setFill(Color.web("#f5f5f5"));
      DropShadow dropShadow = new DropShadow();
      dropShadow.setRadius(50);
      dropShadow.setOffsetX(0);
      dropShadow.setOffsetY(0);
      dropShadow.setColor(Color.web("#969696"));
      rect.setEffect(dropShadow);
      group.getChildren().add(rect);
      return group;
      @SuppressWarnings("unchecked")
      public TableView<Encounter> getTable()
      TableView<Encounter> imageTable = new TableView<Encounter>();
      TableColumn<Encounter, Number> minChanceCol = new TableColumn<Encounter, Number>("Min Chance");
      minChanceCol.setCellValueFactory(new PropertyValueFactory<Encounter, Number>("minChance"));
      TableColumn<Encounter, Number> maxChanceCol = new TableColumn<Encounter, Number>("Max Chance");
      maxChanceCol.setCellValueFactory(new PropertyValueFactory<Encounter, Number>("maxChance"));
      TableColumn<Encounter, MobPict> imgCol = new TableColumn<Encounter, MobPict>("Images");
      imgCol.setCellValueFactory(new PropertyValueFactory<Encounter, MobPict>("mobPicPath"));
      imgCol.setCellFactory(new Callback<TableColumn<Encounter,MobPict>,TableCell<Encounter,MobPict>>()
      @Override
      public TableCell<Encounter, MobPict> call(TableColumn<Encounter, MobPict> param)
      TableCell<Encounter, MobPict> cell = new TableCell<Encounter, MobPict>()
      @Override
      public void updateItem(MobPict item, boolean empty)
      //System.out.println("update Item called");
      //System.out.println(item.getMobName());
      if(item != null)
      VBox box;
      ImageView imgView;
      box= new VBox();
      box.setAlignment(Pos.CENTER);
      imgView = new ImageView();
      imgView.setFitHeight(100);
      imgView.setFitWidth(100);
      imgView.setImage(new Image(TestApp.class.getResource("img").toString()+"/"+item.getMobPicPath()));
      box.getChildren().add(imgView);
      setGraphic(box);
      return cell;
      imageTable.getColumns().addAll(minChanceCol,maxChanceCol, imgCol);
      imageTable.setItems(encounters);
      return imageTable;

    First paste in Number/Date format like:
    DOWNLOAD::::::
    and Apply Change
    after this you will see link BLOB Download Format Mask

Maybe you are looking for

  • HP Envy 6-1110ET Audio Problem

    Hello everyone , I'm having trouble with my ultrabook's audio sometimes.For examle , I'm watching a video on Youtube.When I stop the video for a while (let's say 1 min or 30 sec) and play again , I can't hear any sound.I'm sure that this is not a Fla

  • How do I get Facebook contacts off of my phone after importing them?

    I have the iPhone 5. I've tried to Google this fix, but the solutions don't work for me. I can go under Groups in the Contacts app and remove the check beside Facebook so that my contacts aren't shown, but is there anyway to erase them completely?

  • Use of CL_HTTP_CLIENT to send pdf source

    We are on Portal running xRPM. My WDA populates an InteractiveForm UI element with data. As a result - I have pdfSource xstring which I need to save in Cfolder (this is Collaboration folder within xRPM). I use function CALL FUNCTION 'CFX_API_URL_COL'

  • Actionlistener (or equiv) on the tab's icon in a JTabbedPane

    Imagine for a moment the tab of a JTabbedPane, on it is a nice icon of an "X" in the left(ish) side. When the user clicks this "X" icon, the tab its on closes. If anyone knows how to make this work, and is willing to share the source/example how to d

  • Any Word to Pages conversion apps?

    Finally made the switch to iWork. Are there any apps I can use to quickly and easily convert hundreds of old Word docs into Pages docs? Thanks.