Skip to content

Commit

Permalink
added cell-specific tooltips for non-boolean cell values. issue #2598
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Oct 4, 2024
1 parent 6aabcd3 commit b71b813
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,12 @@
<Property name="dragEnabled" type="boolean" value="true"/>
</Properties>
<Events>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblAttachmentsMousePressed"/>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblAttachmentsMouseClicked"/>
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="tblAttachmentsMousePressed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JTable() {&#xa;@Override&#xa; public String getToolTipText(MouseEvent event) {&#xa; Point point = event.getPoint();&#xa; int row = rowAtPoint(point);&#xa; int column = columnAtPoint(point);&#xa; &#xa; if (row &gt;= 0 &amp;&amp; column &gt;= 0) {&#xa; Object value = getValueAt(row, column);&#xa; if(value instanceof Boolean)&#xa; return null;&#xa; else&#xa; return &quot;&quot; + value;&#xa; }&#xa; return null; // No tooltip&#xa; }&#xa;};"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@
import com.jdimension.jlawyer.services.JLawyerServiceLocator;
import com.jdimension.jlawyer.pojo.PartiesTriplet;
import java.awt.Color;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.dnd.DnDConstants;
Expand Down Expand Up @@ -1179,7 +1180,23 @@ private void initComponents() {
contentPanel = new javax.swing.JPanel();
jLabel9 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
tblAttachments = new javax.swing.JTable();
tblAttachments = new JTable() {
@Override
public String getToolTipText(MouseEvent event) {
Point point = event.getPoint();
int row = rowAtPoint(point);
int column = columnAtPoint(point);

if (row >= 0 && column >= 0) {
Object value = getValueAt(row, column);
if(value instanceof Boolean)
return null;
else
return "" + value;
}
return null; // No tooltip
}
};
jLabel8 = new javax.swing.JLabel();
jToolBar1 = new javax.swing.JToolBar();
cmdSend = new javax.swing.JButton();
Expand Down Expand Up @@ -1358,12 +1375,12 @@ public boolean isCellEditable(int rowIndex, int columnIndex) {
});
tblAttachments.setDragEnabled(true);
tblAttachments.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
tblAttachmentsMousePressed(evt);
}
public void mouseClicked(java.awt.event.MouseEvent evt) {
tblAttachmentsMouseClicked(evt);
}
public void mousePressed(java.awt.event.MouseEvent evt) {
tblAttachmentsMousePressed(evt);
}
});
jScrollPane1.setViewportView(tblAttachments);

Expand Down

0 comments on commit b71b813

Please sign in to comment.