How to add own Listener?

Hi!
The problem is that I have inherited the class MyTrayIcon from TrayIcon with implementing of MouseListener interface to handle mouse double click. But TrayIcon doesn't have method 'addMouseListener' as MyTrayIcon doesn't. So, how can I add listener is this case?

How about looping through the array of listeners and
removing it if it's an instance of ListListener?
if (eventListeners[index] instanceof ListListener)
removeMouseListener(eventListeners[index]);I thought of that, but as I said i my post, eventListeners[] is protected.
How about writing your own ListListener in the
appropriate package which does precisely nothing, and
making sure it goes in the CLASSPATH before the
package you're supposed to use?Nice idea, but unfortunately, when I submit the assignment I have no way of making sure that it does go into the classpath before the package.
Thanks for your help, but I think I'll have to stick with the workaround.
It's not too hard:  public static void setListData(DefaultListModel model, Object data[])
    model.clear();
    for (int i = 0; i < data.length; i++)
      model.addElement(data);

Similar Messages

  • QUESTION: HOW TO ADD OWN SUBJECT IN CCMS

    Hi, All
    QUESTION: HOW TO ADD OWN SUBJECT IN CCMS
    In NW2004s SP20, kernal 4.6C WebAs 620
    I add paramater in RZ21, Method: CCMS_OnAlert_Eamil , Paramater: SUBJECT_ALERT value CCMS Alert from XDV
    But nothing changed when I received e mail it same look like CCMS alerts XDV 20080528 104346
    How can I do that please advicse
    Thanks

    HI,
    Refer
    Blog to implement the email notification:
    /people/federico.babelis2/blog/2006/05/03/solution-manager-cen-and-alerting-configuration-guide-for-dummies
    http://help.sap.com/saphelp_nw04/helpdata/en/ce/c193d07a7343ff9a81db1bdc97b2f7/frameset.htm
    Monitoring with Solution Manager
    http://help.sap.com/saphelp_nw04/helpdata/en/1a/40f83ee0e66856e10000000a114084/frameset.htm
    Configuring the Alert monitoring of Solution Manager 4.0
    Thanks
    Swarup
    Edited by: Swarup Sawant on May 30, 2008 8:07 PM

  • How to know which leaf node i click and how to add a listener to each node?

    hi! hello to all members, i have a problem i know how to create a listener, but i dont know how to add a listener to each leaf node. here is the scenario i want to do, i have a JTree where theres a topic that you can select on each leaf node, so when the user click the specific topic it will open another JFrame,which i dont know how to do it also, that its! the next problem will be how do i know which leaf node i select, so that i can open a right topic before the JFrame will open?please, i am very need this to solve quickly as possible. thanks again to all members.

    What you have to do is to add a mouse listener on your JTree. Try something like this:
    tree.addMouseListener(new java.awt.event.MouseAdapter() {
             public void mouseReleased(MouseEvent e) {
                tree_mouseReleased(e);
    private void tree_mouseReleased(MouseEvent e) {
          TreePath selPath = tree.getSelectionPath();
          // Check If the click is the Right Click
          if (e.isPopupTrigger() == true) {
          // This is your right Click
           else {
                     // This is your Left Click
    }Your other problem: Set the userObject on nodes and on left click compare it with your object, if it matches, display the appropriate file. Alternatively, if your nodes are unique, you can match the names to open the file.
    Hope this Helps
    Regard
    Raheel

  • Project Server 2010:- How to add Own Workspace filter in workspace web part like project server 2007

    Hi All,
    I am using project server 2010.
    Can some one advise me how can I add Own Workspace filter option in workspace web part like project server 2007 which is showing all projects name page by page. There no filter option available. I am not sure if there is any out of box feature. 
    Thanks in Advance..

    Nitin,
    PS2010 shows by default the workspaces you have permissions to. Unfortunately, there is no more filtering options available.
    The only solutions are to write a custom webpart, or develop your own SSRS Report, which you can customize the way you want.
    Refer to Paul's excellent blog post on this topic here:
    http://pwmather.wordpress.com/2011/08/05/custom-projectserver-project-site-workspace-view-in-pwa-ps2010-ps2007-epm-msproject-ssrs/
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:

  • How to add event listener?

    i want to add event listener when i click on a button in mxml, the event listener should be added in the action script file, how to do this?
    can anyone help? urgent!!!

    Hi Lakshmi,
    You can do this just put all the script in the mxml block in seperate AS file as shown below... Observe that I have included an AS file named Script.as and removed the script block form mxml and moved to this Script.as file. Place the Script.as file in your src folder ....
    // Main mxml file....
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
        <mx:Script source="Script.as"/>
    <mx:TextArea id="textArea" width="300" height="100" />
    <mx:Button id="myButton" label="Click ME"/>
    </mx:Application>
    //Script.as file
    import mx.controls.Alert;
                private function onCreationComplete():void
                 myButton.addEventListener(MouseEvent.CLICK, onButtonClick);
                private function onButtonClick(event:MouseEvent):void
                 Alert.show("Button is Clicked");
    Thanks,
    Bhasker

  • How to add a Listener to the JLabel

    Hi,
    I am doing a Designer module in which i want to Listen Focus gained event on JLabel. For that i have added FocusListener to the JLabel but it does not listen to this event. (i think because of JLabels extraodinary property).
    So How to add listener to the JLabel?

    Set the label to be focusable. This will allow it to gain focus from the
    keyboard (from pressing TAB, for example), but not from being clicked on.
    It's easy to give some demo code than to explain it:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class LabelListening extends MouseAdapter implements FocusListener {
        private static final String TEXT_KEY = "jlabel_text_key";
        public void focusGained(FocusEvent e) {
            JLabel label = (JLabel) e.getComponent();
            String text = (String) label.getClientProperty(TEXT_KEY);
            label.setText("<html><u>" + text + "</u></html>");
        public void focusLost(FocusEvent e) {
            JLabel label = (JLabel) e.getComponent();
            String text = (String) label.getClientProperty(TEXT_KEY);
            label.setText(text);
        public void mousePressed(MouseEvent e) {
            e.getComponent().requestFocusInWindow();
        public static void main(String[] args) {
            LabelListening app = new LabelListening();
            JPanel contentPane = new JPanel();
            for(int i=0; i<4; ++i) {
                String text = "label " + i;
                JLabel label = new JLabel(text);
                label.putClientProperty(TEXT_KEY, text);
                label.setFocusable(true);
                label.addFocusListener(app);
                label.addMouseListener(app);
                contentPane.add(label);
            JButton btn = new JButton("a button");
            btn.setBorderPainted(false);
            btn.setContentAreaFilled(false);
            btn.setMargin(new Insets(0,0,0,0));
            contentPane.add(btn);
            final JFrame f = new JFrame("");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(contentPane);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }In this example, I have the focused label underlined. I don't
    know what your context is, but it may be simpler just to work with
    buttons instead. I "undecorate" a button in this example to make it look
    similar to a label.

  • How to add own customized transaction in SPRO (IMG Menu Path)

    Dear All,
    I have a requirement of adding new customized transaction in IMG menu path. Can you please help me out how to do that?
    Best wishes,
    Atanu

    Hi
    Can you try this way:
    You need to modify the structure ( node ) that you want to modify using transaction SIMGH. First you need to go to transaction SIMGH.
    In the IMG structure just press f4 -> you need to give the title of the structure that needs to be edited. f8. Then you can modify the structure -> insert node.
    You need to give the node text.
    After creating the node, click on the node and select insert activity.
    In the ID field give an entry, Give the description in 'name'.
    Please check this link on how to add a node in IMG.
    http://help.sap.com/saphelp_sm32/helpdata/en/9a/b7b2375ca97f68e10000009b38f8cf/content.htm
    Regards,
    Sreeram

  • How to add action listener to internal frame?

    I have frame Main where I am trying to add action listener.
    Action listener should be listening button in frame Menu.
    I think it should be:
    Menu frame = new Menu();
    frame.btn_start.addActionListener(this);but it seems to be doing absolutely nothing.
    If I try to add in menu:
    btn_start.addActionListener(new Main());it generates: java.lang.StackOverflowError
    What should I do? Please help noob :)

    To get better help sooner, post a [_Short, Self Contained, Compilable and Executable, Example Program (SSCCE)_|http://mindprod.com/jgloss/sscce.html] that clearly demonstrates your problem.
    You're quite possible adding the ActionListener to the wrong component. And constructing a new instance of a class within the constructor is likely the cause of your StackOverflowError.
    db

  • MM41/MM42/(MM43) - Sales view: How to add own input validation for CALP-END

    Hello.
    I am looking for an easy way, if any to create an own input validation for a certain field in the article master on the sales view tab. In addition to any standard input validation I would a like to add an own validation (for CALP-ENDPR) depending on the input.
    How can that be achieved in the easiest and proper manner - in general and for the specific case?
    There are no screen exits etc. here, if I am correct.
    Any ideas?
    Thanks.
    C.N.

    Hi,
    Please refer the below link.
    This is for MM01. I understand that you are into Retail system. Hope the same processing logic can be done in your scenario also.
    saptechnical(dot)com(slash)Tutorials(slash)ExitsBADIs(slash)MM(slash)MM01(dot)htm
    Replace the bracket words with the correct symbols.
    With Regards,
    Sumodh.P

  • SSL cert - how to add own?

    Hello. How i can add my own SSL certificate to windows phone 8? I'm using proxy for testing apps, and without my own certificate i can not connect to internet. 
    a

    Hi onmouse,
    Welcome to the forum!
    I have found this link that can give you information about it:
    http://download.microsoft.com/download/D/B/2/DB2D539D-7F4D-46BC-944B-A69EDA43D975/Windows%20Phone%20...
    Hope this helps! 

  • How to add Mouse Listener

    here is my code for my current project, it is to create a platform independent way to have a windows explore like window so far I have it displaying properly and all I need to do is when the user double clicks on a file itt should open up but thats where i need help, this is not homework
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.filechooser.*;
    import javax.swing.*;
    import sun.swing.*;
    import javax.swing.plaf.*;
    import java.io.*;
    import javax.swing.filechooser.*;
    import javax.swing.plaf.*;
    import javax.swing.plaf.basic.*;
    import java.lang.reflect.*;
    import java.beans.*;
    public class FileBrowserAttempt2  extends JFrame
         static FilePane Files;
         static JPanel Details;
         static JPanel list;
         static int activeView = 0;
         JFrame f;
        FileBrowserAttempt2 a = this;
        JPopupMenu pop;
        Action[] actions;
        JFileChooser toGetFileView;
         public  FileBrowserAttempt2(final JFileChooser toGetFileView) throws Exception
               try {
             // Set System L&F
            UIManager.setLookAndFeel(
                UIManager.getSystemLookAndFeelClassName());
             } catch(Exception e)
              Files = getFilePane(toGetFileView);               
                   view = Files.getViewMenu();
                   Details = Files.createDetailsView();
                   list = Files.createList();
                   pop = Files.getComponentPopupMenu();
                   actions = Files.getActions();
              pop.remove(view);
              for(Action Comp : actions)
                   System.out.println(Comp.getValue(Comp.NAME).toString());
              Component[] ary = toGetFileView.getComponents();
              setJMenuBar(createMenuBar());
              JPanel panel = new JPanel(new BorderLayout());
              panel.add(ary[0], BorderLayout.NORTH);
              panel.add(Files, BorderLayout.CENTER);     
              add(panel);
              setDefaultCloseOperation(3);
              pack();
              show();
         // THIS IS THE MOUSE LISTENER
         private class open extends  AbstractAction
                   public void actionPerformed(ActionEvent e)
                        try{
                        Class FileBrowser = FileBrowserAttempt2.this.Files.getClass();
                        Method a = FileBrowser.getMethod("getSelectedFile");
                        System.out.println("Action");
                        File open =(File) a.invoke(null);
                        Runtime.getRuntime().exec("cmd.exe start " + open.toString());
                        }catch(Exception ex)
                             ex.printStackTrace();
         public static void main (String[] args) throws Exception
               new FileBrowserAttempt2(new JFileChooser(new File("C:/")));
         public void printAry(Object[] ary)
              for(Object Comp : ary)
                   System.out.println(Comp.toString());
         private FilePane getFilePane(JFileChooser toGetFileView)
              Component[] components = toGetFileView.getComponents();
              for(Object Comp : components)
                   if(Comp instanceof FilePane)
                        return ((FilePane)Comp);
              return null;
         final JMenu view;
        private JMenuBar createMenuBar()
             JMenuBar menuBar = new JMenuBar();
             JMenu FileMen = new JMenu("File");        
             JMenuItem Exit = new JMenuItem("Exit");
             Exit.addActionListener(new ExitListener());
             FileMen.add(Exit);
             menuBar.add(FileMen);
             menuBar.add(view);
             return menuBar;
    class ExitListener implements ActionListener
         public void actionPerformed(ActionEvent e)
                  System.exit(0);
    }and here are the methods of FilePane
    public static final java.lang.String ACTION_APPROVE_SELECTION;
        public static final java.lang.String ACTION_CANCEL;
        public static final java.lang.String ACTION_EDIT_FILE_NAME;
        public static final java.lang.String ACTION_REFRESH;
        public static final java.lang.String ACTION_CHANGE_TO_PARENT_DIRECTORY;
        public static final java.lang.String ACTION_NEW_FOLDER;
        public static final java.lang.String ACTION_VIEW_LIST;
        public static final java.lang.String ACTION_VIEW_DETAILS;
        public static final int VIEWTYPE_LIST;
        public static final int VIEWTYPE_DETAILS;
        int lastIndex;
        java.io.File editFile;
        int editX;
    javax.swing.JTextField editCell;
        protected javax.swing.Action newFolderAction;
        public sun.swing.FilePane(sun.swing.FilePane$FileChooserUIAccessor);
        public void uninstallUI();
        protected javax.swing.JFileChooser getFileChooser();
        protected javax.swing.plaf.basic.BasicDirectoryModel getModel();
        public int getViewType();
        public void setViewType(int);
        public javax.swing.Action getViewTypeAction(int);
        public void setViewPanel(int, javax.swing.JPanel);
        protected void installDefaults();
        public javax.swing.Action[] getActions();
        protected void createActionMap();
        public static void addActionsToMap(javax.swing.ActionMap, javax.swing.Action[]);
        public javax.swing.JPanel createList();
        public javax.swing.JPanel createDetailsView();
        public javax.swing.event.ListSelectionListener createListSelectionListener();
        public javax.swing.Action getNewFolderAction();
        void setFileSelected();
        public void propertyChange(java.beans.PropertyChangeEvent);
        public void ensureFileIsVisible(javax.swing.JFileChooser, java.io.File);
        public void rescanCurrentDirectory();
        public void clearSelection();
        public javax.swing.JMenu getViewMenu();
        public javax.swing.JPopupMenu getComponentPopupMenu();
        protected sun.swing.FilePane$Handler getMouseHandler();
        protected boolean isDirectorySelected();
        protected java.io.File getDirectory();
        public static boolean canWrite(java.io.File);any help would be appreciated

    Its better you create your own panel to display each of the files, than to display the first element of the 'toGetFileView.getComponents()' In this way, you can add a mouse listener to each of those elements.

  • How to add mouse listener for a single row alone

    I have a requirement. In a JTable when I double click a particular row the cells in the row should set to the width which I have provided.
    The problem with my code is when I click fourth row in the table, the first row gets adjusted.
    So how I need help is
    only if I click the first row, the first row cell size should get adjusted not when I click fourth row.
    Similarly if I give some cell width and height for fourth row cells, then when I double click the fourth row, the fourth should alone get adjusted and not the other rows.
    Hope I have explained clearly.
    How can it be achieved?
    Please find below my code. Everything is hardcoded. So it may look messy. Please excuse.
    // Imports
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    class SimpleTableExample extends JFrame {
    // Instance attributes used in this example
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
         // Set the frame characteristics
         setTitle("Simple Table Application");
         setSize(400, 200);
         setBackground(Color.gray);
         // Create a panel to hold all other components
         topPanel = new JPanel();
         topPanel.setLayout(new BorderLayout());
         getContentPane().add(topPanel);
         // Create columns names
         String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
         // Create some data
         String dataValues[][] = { { data1, data2, "67", "77" },
              { "", "43", "853" }, { "", "89.2", "109" },
              { "", "9033", "3092" } };
         DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
         model.addColumn("PART TITLE");
         model.addColumn("SPECIAL INSTRUCTIONS");
         table = new JTable(model) {
         public boolean isCellEditable(int rowIndex, int colIndex) {
              return false;
         // set specific row height
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
         int colInd = 0;
         TableColumn col = table.getColumnModel().getColumn(colInd);
         int width = 50;
         col.setPreferredWidth(width);
         int colInd2 = 1;
         TableColumn col2 = table.getColumnModel().getColumn(colInd2);
         int width2 = 100;
         col2.setPreferredWidth(width2);
         int colInd3 = 2;
         TableColumn col3 = table.getColumnModel().getColumn(colInd3);
         int width3 = 10;
         col3.setPreferredWidth(width3);
         int colInd4 = 3;
         TableColumn col4 = table.getColumnModel().getColumn(colInd4);
         int width4 = 10;
         col4.setPreferredWidth(width4);
         int colInd5 = 4;
         TableColumn col5 = table.getColumnModel().getColumn(colInd5);
         int width5 = 10;
         col5.setPreferredWidth(width5);
         table.addMouseListener(new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
              if (e.getClickCount() == 2) {
              JTable target = (JTable) e.getSource();
              int row = target.getSelectedRow();
              int column = target.getSelectedColumn();
              TableColumn col1 = table.getColumnModel().getColumn(0);
              col1.setPreferredWidth(50);
              TableColumn col2 = table.getColumnModel().getColumn(1);
              col2.setPreferredWidth(400);
              table.getColumnModel().getColumn(1).setCellRenderer(
                   new TableCellLongTextRenderer());
              table.setRowHeight(50);
              TableColumn col5 = table.getColumnModel().getColumn(4);
              col5.setPreferredWidth(200);
         // Create a new table instance
         // table = new JTable(dataValues, columnNames);
         // Add the table to a scrolling pane
         scrollPane = new JScrollPane(table);
         topPanel.add(scrollPane, BorderLayout.CENTER);
    // Main entry point for this example
    public static void main(String args[]) {
         // Create an instance of the test application
         SimpleTableExample mainFrame = new SimpleTableExample();
         mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
         boolean isSelected, boolean hasFocus, int row, int column) {
         this.setText((String) value);
         this.setWrapStyleWord(true);
         this.setLineWrap(true);
         // set the JTextArea to the width of the table column
         setSize(table.getColumnModel().getColumn(column).getWidth(),
              getPreferredSize().height);
         if (table.getRowHeight(row) != getPreferredSize().height) {
         // set the height of the table row to the calculated height of the
         // JTextArea
         table.setRowHeight(row, getPreferredSize().height);
         return this;
    Edited by: 915175 on Aug 3, 2012 4:24 AM

    Hi
    Try below code. Hope this will help
    import java.awt.BorderLayout;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JTextArea;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    public class SimpleTableExample extends JFrame {
    private JPanel topPanel;
    private JTable table;
    private JScrollPane scrollPane;
    String data1 = "";
    String data2 = "123456789ABCDEFGHIJKLMNOPQRSTUVQWXYZabcdefghijklmnopqrstuvwxyzaquickbrownfoxjumpedoverthelazydog";
    int size = data2.length();
    // Constructor of main frame
    public SimpleTableExample() {
    // Set the frame characteristics
    setTitle("Simple Table Application");
    setSize(400, 200);
    setBackground(Color.gray);
    // Create a panel to hold all other components
    topPanel = new JPanel();
    topPanel.setLayout(new BorderLayout());
    getContentPane().add(topPanel);
    // Create columns names
    String columnNames[] = { "SEL", "DESIGN DATA", "PART NUMBER" };
    // Create some data
    String dataValues[][] = { { data1, data2, "67", "77" },
    { "", "43", "853" }, { "", "89.2", "109" },
    { "", "9033", "3092" } };
    DefaultTableModel model = new DefaultTableModel(dataValues, columnNames);
    model.addColumn("PART TITLE");
    model.addColumn("SPECIAL INSTRUCTIONS");
    table = new JTable(model) {
    public boolean isCellEditable(int rowIndex, int colIndex) {
    return false;
    // set specific row height
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    int colInd = 0;
    TableColumn col = table.getColumnModel().getColumn(colInd);
    int width = 50;
    col.setPreferredWidth(width);
    int colInd2 = 1;
    TableColumn col2 = table.getColumnModel().getColumn(colInd2);
    int width2 = 100;
    col2.setPreferredWidth(width2);
    int colInd3 = 2;
    TableColumn col3 = table.getColumnModel().getColumn(colInd3);
    int width3 = 10;
    col3.setPreferredWidth(width3);
    int colInd4 = 3;
    TableColumn col4 = table.getColumnModel().getColumn(colInd4);
    int width4 = 10;
    col4.setPreferredWidth(width4);
    int colInd5 = 4;
    TableColumn col5 = table.getColumnModel().getColumn(colInd5);
    int width5 = 10;
    col5.setPreferredWidth(width5);
    // Cell Render should apply on each column -- add by Rupali
    for(int i=0; i< table.getColumnModel().getColumnCount(); i++){
    table.getColumnModel().getColumn(i).setCellRenderer( new TableCellLongTextRenderer());
    table.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    if (e.getClickCount() == 2) {
    JTable target = (JTable) e.getSource();
    int row = target.getSelectedRow();
    int column = target.getSelectedColumn();
    setTableCellHeight(table,row,column); //Added by Rupali
    TableColumn col1 = table.getColumnModel().getColumn(0);
    col1.setPreferredWidth(50);
    TableColumn col2 = table.getColumnModel().getColumn(1);
    col2.setPreferredWidth(400);
    TableColumn col5 = table.getColumnModel().getColumn(4);
    col5.setPreferredWidth(200);
    // Create a new table instance
    // table = new JTable(dataValues, columnNames);
    // Add the table to a scrolling pane
    scrollPane = new JScrollPane(table);
    topPanel.add(scrollPane, BorderLayout.CENTER);
    * Created By Rupali
    * This will set cell's height and column's width
    * @param table
    * @param row
    * @param column
    public void setTableCellHeight(JTable table, int row, int column) {
    // set the JTextArea to the width of the table column
    setSize(table.getColumnModel().getColumn(column).getWidth(),
    getPreferredSize().height);
    if (table.getRowHeight(row) != getPreferredSize().height) {
    // set the height of the table row to the calculated height of the
    // JTextArea
    table.setRowHeight(row, getPreferredSize().height);
    // Main entry point for this example
    public static void main(String args[]) {
    // Create an instance of the test application
    SimpleTableExample mainFrame = new SimpleTableExample();
    mainFrame.setVisible(true);
    class TableCellLongTextRenderer extends JTextArea implements TableCellRenderer {
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    this.setText((String) value);
    this.setWrapStyleWord(true);
    this.setLineWrap(true);
    return this;
    }

  • How to add own CustomXPathFunctions to the JDev XPath builder

    Hello,
    I'd be interested to know, if it is possible to add my own CustomXPathFunctions to the JDeveloper BPEL designer so that the XPath builder would recognize them and provide the helps in building the expression. Now, all my own functions are not recognized by the XPath builder although the BPEL engine can run them.
    Best regards,
    Tommi

    Hi,
    I think this is not possible in the current release.

  • How to add map listener

    hi
    how can i add a MapListener in my application so that i can able to fire aevent when some record are inserted or deleted in cache, i am using java API.
    regards
    praveen jian

    Hi,
    Please see this link:
    http://wiki.tangosol.com/display/COH33UG/Deliver+events+for+changes+as+they+occur
    Thanks,
    Patrick

  • How to add a listener for enter key

    I'd like to build a chatzone applcation just like msn. The application
    has two textarea, one is for the messages sent and recieve and one is
    for the message typing area. Just like MSN, I'd like to send the text
    after the user pressed enter key. But my problem is I don't know how
    to make a key listener. I've tried jTextArea1.addKeyListener() but I don't
    know how to use it. Anyone can help me?
    Thanks in advance

    KeyListener is just an interface, so you could use:
    public class MyKeyListener implements KeyListener
       private JTextArea area = null;
       public MyKeyListener (JTextArea area)
            this.area = area;
       // Don't care about a key being pressed.
       public void keyPressed (KeyEvent e) {}
       // Don't care about a key being typed.
       public void keyTypes (KeyEvent e) {}
       // We care about the key being released.
       public void keyReleased (KeyEvent e)
           // Check what key it is.  Note sure if \n is the right one...maybe use the key codes.
           if (e.getKeyChar () == '\n')
                // The return key has been pressed and released, they really meant to press it!
                // Get the last line of the text from the text area.  This bits up to you...maybe
                // store the last location of the caret and then read from that point up
                // to the current point...
    }You can also use a DocumentListener if you are using a JTextArea but this is a little bit more complex but may be better, DocumentListeners work on telling you about more macro changes to the document...

Maybe you are looking for