MouseListener for JTable cells using html

Hello,
I'm trying to write a MouseListener that determines whether the cursor is positioned over a certain string within a JTable cell. The cell contains an html string to allow for some formatting.
For instance, the table data for a certain cell could be "<html><b>SomeBoldText</b>moreText<html>". I would like to detect when a mouse click occurs on the bold text.
My current solution is to create the glyph vector corresponding to the cell content stripped of all html tags and then check if the cursor position is within one of the glyphs that form the string. However, that obviously doesn't take into account the formatting done by html, so its not working very well.
Any suggestions?

the only way you could possibly do this, if you used JEditorPane as a renderer. even then i'm not sure.

Similar Messages

  • I built a website for a customer using HTML only, so it would work on everything, but some of the text numbers are not clear on the ipad. It works perfectly on all the other browsers.

    I built a website for a customer using HTML only, so it would work on any browser, and it works perfectly on everything except ipad safari. I'm loosing information with most of my text numbers - instead of being black they are displaying a 'ghost' image (white) of the numbers.
    Is this a memory issue, or cache issue, or something else?  I've downloaded iCab and the site works perfectly with it.
    Also wondering if I can manually reload/refresh web pages in iPad Safari.
    Since most people with iPads will use Safari rather than iCab, I have to tweak this site to work in Safari.

    Detecting phone numbers and making them clickable is a feature of the browser, and rebuilding your web-site links will not make any difference. Its done when the page is shown in the browser, not when the page is created.
    According to the Safari iOS developers guide, you can turn these data detectors off using this code:
    <meta name = "format-detection" content = "telephone=no">
    http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Referen ce/Articles/PhoneLinks.html

  • Threading design for jTable that uses AbstractTableModel & jProgressBar

    The application consists of a number of jTables that are filled using individual classes that extend AbstactTableModel. I want to use a jProgressBar (setIndeterminate(true)) to show progress is happening when a Search button is pressed. A code snippet is shown below. The method doSearch() calls the classes that populate the jTables. The code works fine but is wrong as components are being updated by a thread other than the EDT. Does this need a complete re-factoring? What design pattern should I be looking to use? Without using this extra thread I cannot get the jProgressBar to show progress.
    if (IbagDatabase.theInstance().isConnected()) {
                  jProgressBarSearch.setVisible(true);
                  jProgressBarSearch.setStringPainted(true); //get space for the string
                  jProgressBarSearch.setIndeterminate(true);
                  jProgressBarSearch.setString("Searching ..."); //display % string             
                  Runnable i = new Runnable()           {
                      public void run() {
                          doSearch();
                          jProgressBarSearch.setIndeterminate(false);
                          jProgressBarSearch.setString("");
                          jProgressBarSearch.setVisible(false);
                  Thread t = new Thread( i );
                  t.start();             
                  //doSearch();
            }

    Using a separate Thread for the long running task is the correct design.
    The only change you need is that when you want to update a GUI component you need to wrap the update code in a SwingUtilities.invokeLater(...). Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html]How to Use Threads for more information.

  • Setting borders for JTable cells

    How can i create custom / user defined borders for cells in JTable (swing).I need to have borders like only top/bottom,left/right borders for cells. I came to know that it could be possible with paintBorder() method of AbstractBorder interface. But i need a sample code of how it has been done.
    Thanks & Regards
    M.Shanthakumari

    You need to create a custom table cell renderer to do what you are asking. It is what actually draws the cells. Just subclass the DefaultTableCellRenderer and override the getTableCellRendererComponent() method. Look at the source for that class, and just change it to add your logic to use a different border depending on the cell to be drawn.

  • How to display cusomized custom tooltip(jwindow)  in jtable cell position

    Hi,
    i am trying to display custom tooltip for jtable cell. i created custom tooltip(jwindow) and on mouseover of jtable cell i am trying to display the custom tooltip.
    But it is not display the position of jtable cell. How to display the exact position of jtable cell
    please help me on this.

    Did you read the posting directly below yours which was also about a custom tool tip?
    JScrollableToolTip is buggy
    The code presented there shows the tool tip in the proper location.
    For more help create a [url http://sscce.org]SSCCE, that demonstrates the incorrect behaviour.
    Don't forget to read the "Welcome to the new home" posting at the start of the forum to learn how to use the "code tags" so posted code is formatted and readable.

  • JTable, cells lost focus

    How can I get or listen to event when my cell lost focus ??

    The correct answer is to... well, that should be saved for the Swing forum. or alternatively, its in the text for THE FIRST google result for "jtable cell listener".

  • Border for Excel Cells generated using HTML

    Hi,
    I am generating html at server side and writing the content with
    content type application/xls, all the generated data downloads to
    me in excel sheet. Here in this excel document, I dont have borders
    for the cell where i dont have the data. But for the cells, where data
    is placed, cell borders are available. How do i make the whole excel sheet
    cells as bordered.
    Thanks in advance.
    Regards,
    Rizwan.

    If I have table border="1" they show up. I want
    borders even in other parts of the excel sheet where
    table is not there. Is it possible for that to get
    the borders in entire excel sheet where data is
    present and even if data is not present?IIRC, it would not be possible unless you paint all those borders on the HTML page. An alternate way is to generate the Excel sheet using Jakarta POI, but that would only make your work tougher.

  • How to use Jtable cell Editor

    HI,
    Here trying to populate the ImageIcon using JLabel in Jtable cell. For that I used DefaultCellRenderer. For implement the mouseListener to label I used the DefaultCellEditor. I am facing one problem here. After editing the label I selected the second row of the table, the first row image is not displaying. Can any one help on this issue?
    public class LabelCellEditor extends DefaultCellEditor {
    public LabelCellEditor(final JCheckBox checkBox) {
    super(checkBox);
    public Component getTableCellEditorComponent(final JTable table, final Object value,
    final boolean isSelected, final int row, final int column) {
    Color background = null;
    background = ColorManager.SELECTED_ROW_BGCOLOR;
    labelVal = (JLabel) value;
    labelVal.setOpaque(true);
    labelVal.setFont(FontManager.TABLE_DATA_FONT);
    labelVal.setBackground(background);
    labelPanel = new JPanel();
    labelPanel.setOpaque(true);
    labelPanel.setBackground(background);
    labelPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    labelPanel.setBorder(new EmptyBorder(5, 0, 0, 0));
    labelPanel.add(labelVal);
    return this.labelPanel;
    public Object getCellEditorValue() {
    return this.labelPanel;
    public class LabelCellRenderer extends DefaultTableCellRenderer {
    public LabelCellRenderer(final int alignment) {
    //setHorizontalAlignment(alignment);
    this.align = alignment;
    public Component getTableCellRendererComponent(final JTable table, final Object value,
    final boolean isSelected, final boolean hasFocus, final int row, final int column) {
    if (value != null) {
    if (value instanceof JLabel) {
    labelVal = (JLabel) value;
    labelVal.setOpaque(true);
    labelVal.setFont(FontManager.TABLE_DATA_FONT);
    labelVal.setBackground(background);
    labelVal.setHorizontalAlignment(this.align);
    labelVal.setBorder(new EmptyBorder(0, LRPADD, 0, LRPADD));
    JPanel panel = new JPanel();
    panel.setOpaque(true);
    panel.setBackground(background);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT));
    panel.setBorder(new EmptyBorder(5, 0, 0, 0));
    panel.add(labelVal);
    return panel;
    return this;
    }

    With more than 30 postings you should know by now how to use the "Code" tags when posting code so the code reatains its original formatting and is therefore more readable.
    There is no need to create a custom editor, here is a simple example.

  • Way to listen for change in JTable cell?

    I am having troubles trying to catch a key event while the user is entering text inside a given JTable cell (x/y location). The JTable only seems to manage String objects in it's cells so I can't place a JTextField in there with a KeyListener on it.
    Currently, I can only get control of the application once the user has left the cell they are editing.
    Does anyone have an example of a JTable 'cell KeyListener' scenario? At this point I want to see if I can print 'hello world' each time I type a character within a cell. Then I'll go from there....

    If you want to know when the contents of a cell have been updated you should use a TableModelListener.
    If you want to know when a character is added/removed from the cell editor then you need to first understand how this works with a simple text field.
    Typically you would use a DocumentListener to receive notifies of a change to the text field. However, within the DocumentEvent you wouldn't be able to change the text field as this notification comes after the text field has already been updated.
    If you need to ability to intercept changes to the text field before they happen, then you would need to use a DocumentFilter. An example of using a DocumentFilter is given in the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html#filter]Text Component Features.
    Once you get your regular text field working the way you want, the next step to create a DefaultCellEditor using this JTextField and use this editor in your JTable. The above tutorial also has a section on using editors in a table.

  • POP3 & IMAP Email setup for both Wifi & Cell use separately...

    Hello,
    I was asked to post info about this by an iPhone support rep.
    I initially had lots of trouble setting accounts for use with both my WiFi home and office networks and for use through the ATT cell network.
    If you have a question as to how to setup email for both WiFi and Cell use, answer is you can't configure these manually and you don't want to...the phone does this automatically...and seamlessly. (you will NOT see the change in the advanced settings menu, this occurs internally, the settings appear the same)
    The problem: Accounts changing settings automatically...when manually configuring two separate accounts with the same email address but trying to setup the outgoing settings for different ports...one for WiFi (your broadband server acct / port 587) and one for Cell (cwmx.com / port 25)...THIS WON'T WORK!! My WiFi configured email accounts would automatically switch to Cellular configured email accounts as long as they had the same email address. Even though I gave them different names, the phone looks at the "actual email address" and if they are the same it changes your configuration to match the other account (it does this by matching the account that was either ON or OFF first and as soon as you match the second account to that setting (either ON or OFF) the phone switches the settings to match the first account.
    The Solution: (End of the Story first for those who have or are facing this problem): Be sure to setup the email accounts for use with your WiFi account first (and ONLY), as when you leave the WiFi area or turn off the WiFi setting the email account will automatically reconfigure itself for use with the ATT Cellular network...then the settings will switch back when you re-connect to the WiFi area(s). The settings that you will "SEE" are your setup for WiFi, this will not change even when using the Edge network (at least not what is displayed in the "advanced" menu). You will still see Port 587, even though the phone is changing setups internally and changes back once back on a WiFi network, you just don't see the changes.
    *I hope this helps!*
    (more details below for those who might be interested and _for those who may be trying to setup using COMCAST Broadband_)...
    My issue began because I could not get my Comcast setup to work for outgoing email. So I was advised to setup for the Edge port settings by an iPhone support person from ATT...this was a huge error. Because I attempted to do this it actually kept the phone from smoothly converting settings as needed. I only discovered this after resolving the actual problem with my WiFi (Comcast Broadband settings) issue which was actually the setup that MUST HAVE a user ID and Password, at least when using a Comcast Broadband account. Unlike the rest of my XP and ME computers on my networks which do not require this info, the iPhone DOES.
    Because I could not get outgoing mail to work with my broadband setup I attempted to setup two accounts for each email address...one for Cellular and one for WiFi for when I would figure out my problem...or for just sending email more quickly. This does not work as the conflict causes a nightmare. This is something the iPhone support folks should have explained but failed to do so, perhaps as they didn't know this?
    Bottom line: Let the phone do the choosing...it works great and will avoid YOU wasting TWO DAYS and more than 12 hours on the phone with iPhone Support as I did. I eventually figured the port switching issues and solutions on my own through trial and error and luckily one bright iPhone support person advised me that he knew for sure that when using the iPhone with Comcast you must setup "outgoing settings" using an "ID" and "Password" which I was provided by Comcast in only a few minutes. I don't use their emial account but I setup one just for this purpose. Once done, my email accounts began working normally. Once I resolved the conflict issues listed above the phone now works great both WiFi and Cell.
    -Rich

    fullspool,
    Comcast offers an authenticating SMTP server that should work for you on WiFi and EDGE both.
    The settings are linked in this Apple knowledge base article:
    http://docs.info.apple.com/article.html?artnum=306074
    The Comcast link is:
    http://www.comcast.net/help/faq/index.jsp?faq=Emailtop18913
    From that link the settings are:
    Your email address: [email protected]
    The email server type (POP)
    Incoming mail server: mail.comcast.net
    Outgoing mail server: smtp.comcast.net
    With SSL on for both incoming and outgoing.
    Hope this helps,
    Nathan C.

  • How can I use JTextField as JTable cell editor while using AbstractTableMod

    I use this code but can not edit field
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.text.*;
    public class Main extends JFrame {
    JTable table;
    MyTableModel tableModel;
    public Main() {
    super("Colored JTable Demonstration");
    tableModel = new MyTableModel(10, 5);
    table = new JTable(tableModel);
    DefaultTableCellRenderer colorRenderer = new DefaultTableCellRenderer() {
    public void setValue(Object value) {
    if (value instanceof ColoredItem) {
    Color fcolor = ((ColoredItem) value).getForeground();
    Color bcolor = ((ColoredItem) value).getBackground();
    this.setForeground(fcolor);
    this.setBackground(bcolor);
    setText(((ColoredItem) value).getValue());
    table.setDefaultRenderer(Object.class, colorRenderer);
    //table.setDefaultEditor(Object.class, new DefaultCellEditor(new JTextField()));
    //Set up real input validation for the integer column.
    TableCellEditor editor = new DefaultCellEditor(new JTextField()) {
    public Component getTableCellEditorComponent(JTable table,
    Object value, boolean isSelected, int row, int column) {
    super.getTableCellEditorComponent(table, value, isSelected,row, column);
    JTextField myField = (JTextField) getComponent();
    //myField.setDocument(new ValidDocument());
    return myField;
    //if(value==null) return null;
    //return null;
    int numbercolumn = table.getColumnCount();
    for(int i = 0; i< numbercolumn ; i++){
    table.getColumnModel().getColumn(i).setCellEditor(editor);
    // table.getColumnModel().getColumn(i).setCellRenderer(new ColorRenderer());
    //table.validate();
    JScrollPane scrollPane = new JScrollPane(table);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    JPanel radioPanel = new JPanel(new GridLayout(1, 5));
    JRadioButton redRadio = new JRadioButton("Red");
    JRadioButton greenRadio = new JRadioButton("Green");
    JRadioButton blueRadio = new JRadioButton("Blue");
    JRadioButton yellowRadio = new JRadioButton("Yellow");
    JRadioButton blackRadio = new JRadioButton("Black");
    // Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(redRadio);
    group.add(greenRadio);
    group.add(blueRadio);
    group.add(yellowRadio);
    group.add(blackRadio);
    radioPanel.add(redRadio);
    radioPanel.add(greenRadio);
    radioPanel.add(blueRadio);
    radioPanel.add(yellowRadio);
    radioPanel.add(blackRadio);
    RadioListener radioListener = new RadioListener();
    redRadio.addActionListener(radioListener);
    greenRadio.addActionListener(radioListener);
    blueRadio.addActionListener(radioListener);
    yellowRadio.addActionListener(radioListener);
    blackRadio.addActionListener(radioListener);
    // add radiopanel to container
    JPanel panel = new JPanel(new GridLayout(2, 1));
    panel.add(new JLabel("Select color for selected cell:"));
    panel.add(radioPanel);
    getContentPane().add(BorderLayout.SOUTH, panel);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    class ValidDocument extends PlainDocument {
    public void insertString(int index, String s, AttributeSet a)
    throws BadLocationException {
    if ((s == null) || (s.length() == 0)) {
    return;
    StringBuffer t = new StringBuffer(getLength() + s.length());
    t.append(getText(0, index));
    t.append(s);
    t.append(getText(index, getLength() - index));
    if(s.equals("1") && t.toString().equals("1")){               
    super.insertString(index, s, a);
    if(s.equals("0") && t.toString().equals("0")){
    super.insertString(index, s, a);
    if(s.equals(".") && t.toString().equals("0.")){
    super.insertString(index, s, a);
    if(s.equals("5") && t.toString().equals("0.5")){
    super.insertString(index, s, a);
    if(s.equals("b") && t.toString().equals("b")){
    super.insertString(index, s, a);
    //if (super instanceof ColoredItem) {
    // Color fcolor = ((ColoredItem) value).getForeground();
    // Color bcolor = ((ColoredItem) value).getBackground();
    // this.setForeground(fcolor);
    // this.setBackground(bcolor);
    //super.setText(t.toString());
    System.out.println("hehe");
    class RadioListener implements ActionListener {
    public void actionPerformed(ActionEvent ae) {
    int row = table.getSelectedRow();
    int column = table.getSelectedColumn();
    ColoredItem ci = (ColoredItem) tableModel.getValueAt(row, column);
    if (ae.getActionCommand().equals("Red"))
    ci.setBackground(Color.red);
    else if (ae.getActionCommand().equals("Green"))
    ci.setBackground(Color.green);
    else if (ae.getActionCommand().equals("Blue"))
    ci.setBackground(Color.blue);
    else if (ae.getActionCommand().equals("Yellow"))
    ci.setBackground(Color.yellow);
    else if (ae.getActionCommand().equals("Black"))
    ci.setBackground(Color.black);
    System.out.println(ci.getValue());
    // necessary to cause a fireTableCellUpdated event
    tableModel.setValueAt(ci, row, column);
    private class ColoredItem {
    private String value;
    private Color foreground;
    private Color background;
    public ColoredItem(String value, Color foreground, Color background) {
    this.value = value;
    this.foreground = foreground;
    this.background = background;
    public void setValue(String value) {
    this.value = value;
    public void setForeground(Color foreground) {
    this.foreground = foreground;
    public void setBackground(Color background) {
    this.background = background;
    public String getValue() {
    return value;
    public Color getForeground() {
    return foreground;
    public Color getBackground() {
    return background;
    class MyTableModel extends AbstractTableModel {
    String [] columnNames;
    ColoredItem [][] data;
    MyTableModel(int rows, int columns) {
    columnNames = createColumnElements(columns);
    data = createTableElements(rows, columns);
    public int getColumnCount() {
    return columnNames.length;
    public int getRowCount() {
    return data.length;
    public String getColumnName(int col) {
    return columnNames[col];
    public Object getValueAt(int row, int col) {
    return data[row][col];
    public Class getColumnClass(int c) {
    return getValueAt(0, c).getClass();
    public void setValueAt(ColoredItem value, int row, int col) {              
    data[row][col] = value;
    //System.out.println((ColoredItem)value.getValue());
    //temp.setValue((ColoredItem)value.getValue());
    fireTableCellUpdated(row, col);
    private String[] createColumnElements(int columns) {
    String[] data;
    data = new String[columns];
    for (int i=0; i<columns; i++) {
    data[i] = new String("Column " + i);
    return data;
    private ColoredItem [][] createTableElements(int rows, int columns) {
    ColoredItem [][]data;
    data = new ColoredItem[rows][];
    for (int i=0; i<rows; i++) {
    data[i] = new ColoredItem[columns];
    for (int j=0; j<columns; j++) {
    data[i][j] = new ColoredItem("", Color.black, Color.white);
    return data;
    public boolean isCellEditable(int rowIndex, int columnIndex) {
    return true;
    public static void main(String []args) {
    Main main = new Main();
    main.pack();
    main.setVisible(true);
    }

    JTextField jtxf=new JTextField();
         private void setColumns() {
    TableColumn column = null;
    if(this.getRowCount()>0){
    for (int i = 0; i < this.getColumnCount(); i++) {
    column = this.getColumnModel().getColumn(i);
              DefaultCellEditor dce = new DefaultCellEditor(jtxf);
              column.setCellEditor(dce);
              dce.setClickCountToStart(1);
    simply call this method in constructor it will help u

  • Tab transversal while using JTextArea as a JTable cell editor..

    I'm working on a project that will use a JTable with a JTextArea cell editor to create a chart for classroom scheduling. Searching on Google, I found a way to use a JTextArea as a cell editor and render the cell properly. However, when editing a cell, pressing the Tab key inserts a tab, rather than leaving the cell and going to the next one, as happens with just a regular JTable. In fact, none of the keyboard shortcuts that work on a JTable work once the JTextArea cell editor is used. Does anyone know of any way to resolve this? Below is some code I'm using to create a sample GUI, just to verify that I can do this. Another question is would it be easier to use a bunch of JLabels and JTextAreas, remove the padding from those JTextAreas, and try to allow for Tab transversals between stand-alone JTextAreas, rather than JTextAreas as JTable cell editors?
    Thanks!
    package edu.elon.table;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class GUI
         private JFrame frame;
         private String[] columnNames = {"Classroom", "8:00-9:10", "9:25-10:35",
              "10:50-12:00", "12:15-1:25", "1:40-2:50", "1:40-3:20 (MW)",
              "3:35-5:15 (MW)", "5:30-7:10 (MW)"};
         private Object[][] data = {columnNames,
              {"ALAM 201 (42)\nENG 110 LAB", "", "", "", "", "", "", "", ""},
              {"ALAM 202 (42)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 203 (38)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 205 (40)\n", "", "", "", "", "", "", "", ""},
              {"ALAM 206 (39)\nSINK, TV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 207 (40+)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 214 (38)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 215 (42)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 216 (42)\n", "", "", "", "", "", "", "", ""},
              {"ALAM 301 (40)\nTV/VCR", "", "", "", "", "", "", "", ""},
              {"ALAM 302 (38)\nDP/DVD", "", "", "", "", "", "", "", ""},
              {"ALAM 304 (35)\nFRENCH", "", "", "", "", "", "", "", ""},
              {"ALAM 314 (30)\nDP, PSY, COMPUTER ASSISTED", "", "", "", "", "", "",
              {"ALAM 315 (40)\nPC LAB, DP/DVD", "", "", "", "", "", "", "", ""}};
         private JTable table;
         public GUI()
              frame = new JFrame();
              table = new JTable(data, columnNames);
              table.setRowHeight(table.getRowHeight()*2);
              TableColumnModel cModel = table.getColumnModel();
              TextAreaRenderer renderer = new TextAreaRenderer();
              TextAreaEditor editor = new TextAreaEditor();
              for (int i = 0; i < cModel.getColumnCount(); i++)
                   cModel.getColumn(i).setCellRenderer(renderer);
                   cModel.getColumn(i).setCellEditor(editor);
              frame.setLayout(new GridLayout(1,0));
              frame.add(table);
              frame.pack();
              frame.setVisible(true);
    public static void main (String[] args)
    GUI gui = new gui();
    * Written by Dr. Heinz Kabutz, found through online newsletter via Google.
    class TextAreaRenderer extends JTextArea
    implements TableCellRenderer {
    private final DefaultTableCellRenderer adaptee =
    new DefaultTableCellRenderer();
    /** map from table to map of rows to map of column heights */
    private final Map cellSizes = new HashMap();
    public TextAreaRenderer() {
    setLineWrap(true);
    setWrapStyleWord(true);
    public Component getTableCellRendererComponent(//
    JTable table, Object obj, boolean isSelected,
    boolean hasFocus, int row, int column) {
    // set the colours, etc. using the standard for that platform
    adaptee.getTableCellRendererComponent(table, obj,
    isSelected, hasFocus, row, column);
    setForeground(adaptee.getForeground());
    setBackground(adaptee.getBackground());
    setBorder(adaptee.getBorder());
    setFont(adaptee.getFont());
    setText(adaptee.getText());
    // This line was very important to get it working with JDK1.4
    TableColumnModel columnModel = table.getColumnModel();
    setSize(columnModel.getColumn(column).getWidth(), 100000);
    int height_wanted = (int) getPreferredSize().getHeight();
    addSize(table, row, column, height_wanted);
    height_wanted = findTotalMaximumRowSize(table, row);
    if (height_wanted != table.getRowHeight(row)) {
    table.setRowHeight(row, height_wanted);
    return this;
    private void addSize(JTable table, int row, int column,
    int height) {
    Map rows = (Map) cellSizes.get(table);
    if (rows == null) {
    cellSizes.put(table, rows = new HashMap());
    Map rowheights = (Map) rows.get(new Integer(row));
    if (rowheights == null) {
    rows.put(new Integer(row), rowheights = new HashMap());
    rowheights.put(new Integer(column), new Integer(height));
    * Look through all columns and get the renderer. If it is
    * also a TextAreaRenderer, we look at the maximum height in
    * its hash table for this row.
    private int findTotalMaximumRowSize(JTable table, int row) {
    int maximum_height = 0;
    Enumeration columns = table.getColumnModel().getColumns();
    while (columns.hasMoreElements()) {
    TableColumn tc = (TableColumn) columns.nextElement();
    TableCellRenderer cellRenderer = tc.getCellRenderer();
    if (cellRenderer instanceof TextAreaRenderer) {
    TextAreaRenderer tar = (TextAreaRenderer) cellRenderer;
    maximum_height = Math.max(maximum_height,
    tar.findMaximumRowSize(table, row));
    return maximum_height;
    private int findMaximumRowSize(JTable table, int row) {
    Map rows = (Map) cellSizes.get(table);
    if (rows == null) return 0;
    Map rowheights = (Map) rows.get(new Integer(row));
    if (rowheights == null) return 0;
    int maximum_height = 0;
    for (Iterator it = rowheights.entrySet().iterator();
    it.hasNext();) {
    Map.Entry entry = (Map.Entry) it.next();
    int cellHeight = ((Integer) entry.getValue()).intValue();
    maximum_height = Math.max(maximum_height, cellHeight);
    return maximum_height;
    * Written by Dr. Heinz Kabutz, found through online newsletter via Google.
    class TextAreaEditor extends DefaultCellEditor
    public TextAreaEditor() {
         super(new JTextField());
    final JTextArea textArea = new JTextArea();
    textArea.setWrapStyleWord(true);
    textArea.setLineWrap(true);
    JScrollPane scrollPane = new JScrollPane(textArea);
    scrollPane.setBorder(null);
    editorComponent = scrollPane;
    delegate = new DefaultCellEditor.EditorDelegate() {
    public void setValue(Object value)
    textArea.setText((value != null) ? value.toString() : "");
    public Object getCellEditorValue()
    return textArea.getText();
    }

    Using the KeyEvent manager and playing around with the JTextArea, I was able to get a JTable using JTextAreas as the cell editors that worked very close to the way the regular JTable works. You have to hit Tab twice to shift focus to another cell, or hit Tab once and then an arrow key. Also, Alt-Enter will allow you to enter a cell for editing. All of the changes were made to the TextAreaEditor class, which should now read as follows:
    class TextAreaEditor extends DefaultCellEditor implements KeyListener
         private int lastKeyCode;
         public TextAreaEditor(final JTable table) {
              super(new JTextField());
              lastKeyCode = KeyEvent.CTRL_DOWN_MASK;
              final JTextArea textArea = new JTextArea();
              textArea.setWrapStyleWord(true);
              textArea.setLineWrap(true);
              textArea.addKeyListener(this);
              textArea.setFocusable(true);
              textArea.setFocusAccelerator((char) KeyEvent.VK_ENTER);
              JScrollPane scrollPane = new JScrollPane(textArea);
              scrollPane.setBorder(null);
              scrollPane.setFocusable(false);
              editorComponent = scrollPane;
              delegate = new DefaultCellEditor.EditorDelegate() {
                   public void setValue(Object value) {
                        textArea.setText((value != null) ? value.toString() : "");
                   public Object getCellEditorValue() {
                        return textArea.getText();
         public void keyTyped(KeyEvent ke)
              // TODO Auto-generated method stub
         public void keyPressed(KeyEvent ke)
              if (ke.getKeyCode() == KeyEvent.VK_TAB)
                   ke.consume();
                   KeyboardFocusManager.getCurrentKeyboardFocusManager()
                             .focusNextComponent();
                   return;
              if (ke.getKeyCode() == KeyEvent.VK_TAB && ke.isShiftDown())
                   ke.consume();
                   KeyboardFocusManager.getCurrentKeyboardFocusManager()
                             .focusPreviousComponent();
                   return;
              if ((lastKeyCode == KeyEvent.CTRL_DOWN_MASK) &&
                        (ke.getKeyCode() == KeyEvent.VK_ENTER))
                   ke.consume();
                   editorComponent.requestFocus();
              else
                   lastKeyCode = ke.getKeyCode();
         public void keyReleased(KeyEvent ke)
              // TODO Auto-generated method stub
         }

  • How can I keep My 2 email accounts and all other using HTML? It only lasts temporarily, i.e. for the day...

    (1) - when I open Firefox I recently have clicked on the hyperlink for HTML at the bottom of page, it works great for my gmail and yahoo accounts. However, it is not a permanent fix, as it apparently lasts just for the daily session. How can I keep my internet, et al. HTML permanently?
    (2) - Firefox v24.0 is said to be fast and faster! However, I am not finding it so. when I click on a link or open a tab, it is frustrating as the tab labors too long to open...I more than not click on reload, which appears to help somewhat. Any suggestions?
    (3) - I've just printed out the Mozilla Support Q&A on the error message from Firefox stating that it cannot load the website...how to I remedy this, as it occurs constantly with my Yahoo mail login?
    (4) Finally, several weeks ago I inadvertently popped the "HEALTH" Bookmark (I have a Bookmarks Toolbar), which is excellent (had it with WinXP also, now with Win7), but I seem to pop, double click, or something or other, that makes a bookmark folder jump into the wild blue yonder! I've posted for answers here and elsewhere, printed out and read all variable instructions to navigate and locate, all to no avail. More sage advice please?
    with appreciation and, thanks in advance.

    For #1, is the link to use HTML to simplify the interface?
    It may be that the site stores your preference in a cookie, and you might have set Firefox to delete the cookie when you exit the browser. There are a few built-in ways to do this:
    * Set Firefox to "Keep [cookies] until: I close Firefox" on the Privacy Options (you can create an exception for your mail sites)
    * Set Firefox to "Clear history when Firefox closes" on the Privacy Options
    * Use a private browsing window to visit your mail site
    It's also possible that add-ons or external software may clean out cookies, or that there is a problem with the database file Firefox uses the store cookies.
    For #2, did this problem just start recently? Do you notice any relationship with the type of site content (e.g., pages that use Flash or other media)?

  • How to use HTML Video for iPad in iWeb

    I agree with all the advantages of HTML Video. How do you use html video on your iweb site?
    I want my iWeb site video to be viewable on iPads.
    I have learned the technique to use the HTML Snippet tool in iWeb to successfully post Flash video. I created all of my animations using Kenote's keyframe ability and have exported them to Quicktime and then have converted them into flash with Vertical Moon's Video to SWF. Then simply upload the SWF file to a folder on your idisk, then use the Flash Video insert HTML Snippet and insert the idisk url of the SWF file and you are done. What is the technique for HTML Video?
    I have found some HTML video encoders, here are the links:
    http://www.projekktor.com/ the technique is not clear to me and appears complicated.
    http://www.brightcove.com/en/ this one is way too expensive at $99 a month.
    http://jilion.com/sublime/video this one looks great but is not yet available and I am guessing it is a converter that will make your iMovie Quicktime into HTML Video.
    I have all of the i-Apps and Final Cut Express (2 revs out of date). Can I get the proper HTML video file from these programs, unless I am missing something I don't think so.
    Most people do not believe I made my site completely with Keynote and iWeb but here it is. http//www.falcon-pacific.com
    Thank You Very Much for considering my question. I will put the results on my iWeb site and the exact procedure and acknowledge all the sources of the solution.

    I want my iWeb site video to be viewable on iPads.
    Your videos ARE viewable on a iPad. No need for explicit HTML video coding.
    If you export your movies to iPhone that's all there is to do. You can do it in QT Pro/iMovie
    And HTML Video is a HTML code, not the movie itself :
    <video width="480" height="270" src="movie.m4v" controls></video>
    I use the iPad simulator in the SDK :
    http://developer.apple.com/ipad/sdk/
    Here's the result :
    http://ipad.dailynews.webege.com
    My blog : [html5 video|http://www.wyodor.net/blog/archives/2009/06/entry_181.html]
    And some links in my post in this topic : [HTML 5 in IWEB|http://discussions.apple.com/thread.jspa?threadID=2404927&tstart=30]

  • Using RH10 - what's the easiest way to create and save HTML code as a snippet for later re-use?

    I am using RH10 to maintain and update several WebHelp projects for customer-facing Internet applications. I am noticing inconsistencies in css and html so I would like to create several snippets for later re-use.  My wishlist, so far:  FAQ page with internal bookmarks, product image with table of callouts, and basic page template with corporate header and footer. What's the easiest way to save / export a page that I want to use later as a snippet? Thank you.

    Have you thought about using the Resource Manager?

Maybe you are looking for

  • 2.0 & iTunes 7.1 Screwed Original iPhone Big Time!

    It seems a lot of people are having issues with 2.0 and 7.1 iTunes but wondering if anyone is seeing these issues. I've add my original iPhone since Day 1 release (yes, 4 hours in line) and have been preaching the praises of Apple and this phone for

  • Turning off sync without loosing music

    After a year of managing my own music transfers I made the mistake of using iTunes sync to give my iPod a fresh reload to make sure all my edits to the library were up to date. Now I can't turn off sync without iTunes threatening to erase everything

  • Changing a Once Blank Password

    I set my password to blank and now when I try to change it, it asks me to put in a password for my old password in the users section. What do I do? PS. I don't recommend a blank password because it can screw up your computer when you first turn it on

  • Language change in pages

    Hi everyone, Need a little help here. My computer set up in Dutch but I want to write a letter in English and of course have the spelling checked. But I can't seem to find where I can change the language. Checked the help pages and the manual, and I'

  • How do I reclaim the "Other" space on a iMac?

    I delete files regulary and the "Other" section is still taking up 359gb