import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
/**
* This class provides the swing GUI layout for FTS Panel and implements most of
protected JButton btn_cancel = new JButton();
- protected JTextField txt_search = new JTextField(20);
+ protected JTextField txt_search = new JTextField(35);
protected SequenceFetcher seqFetcher;
private JTable tbl_summary = new JTable()
{
+ private boolean inLayout;
+
+ @Override
+ public boolean getScrollableTracksViewportWidth()
+ {
+ return hasExcessWidth();
+
+ }
+
+ @Override
+ public void doLayout()
+ {
+ if (hasExcessWidth())
+ {
+ autoResizeMode = AUTO_RESIZE_SUBSEQUENT_COLUMNS;
+ }
+ inLayout = true;
+ super.doLayout();
+ inLayout = false;
+ autoResizeMode = AUTO_RESIZE_OFF;
+ }
+
+ protected boolean hasExcessWidth()
+ {
+ return getPreferredSize().width < getParent().getWidth();
+ }
+
+ @Override
+ public void columnMarginChanged(ChangeEvent e)
+ {
+ if (isEditing())
+ {
+ removeEditor();
+ }
+ TableColumn resizingColumn = getTableHeader().getResizingColumn();
+ // Need to do this here, before the parent's
+ // layout manager calls getPreferredSize().
+ if (resizingColumn != null && autoResizeMode == AUTO_RESIZE_OFF
+ && !inLayout)
+ {
+ resizingColumn.setPreferredWidth(resizingColumn.getWidth());
+ }
+ resizeAndRepaint();
+ }
+
@Override
public String getToolTipText(MouseEvent evt)
{
lbl_loading.setVisible(false);
lbl_loading.setFont(new java.awt.Font("Verdana", 0, 12));
- tbl_summary.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
tbl_summary.setAutoCreateRowSorter(true);
tbl_summary.getTableHeader().setReorderingAllowed(false);
tbl_summary.addMouseListener(new MouseAdapter()
}
}
});
-
- scrl_searchResult.setPreferredSize(new Dimension(500, 300));
- scrl_searchResult
- .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrl_searchResult.setPreferredSize(new Dimension(800, 400));
cmb_searchTarget.setFont(new java.awt.Font("Verdana", 0, 12));
cmb_searchTarget.addActionListener(new ActionListener()
}
};
tabbedPane.addChangeListener(changeListener);
- tabbedPane.setPreferredSize(new Dimension(500, 300));
+ tabbedPane.setPreferredSize(new Dimension(800, 400));
tabbedPane.add(searchTabTitle, scrl_searchResult);
tabbedPane.add(configureCols, new FTSDataColumnPreferences(
PreferenceSource.SEARCH_SUMMARY, getFTSRestClient()));
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), 800, 400);
+ Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), 900, 500);
}
public class DeferredTextInputListener implements DocumentListener