本文整理匯總了Java中org.jdesktop.swingx.JXTable.setRowHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.setRowHeight方法的具體用法?Java JXTable.setRowHeight怎麽用?Java JXTable.setRowHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdesktop.swingx.JXTable
的用法示例。
在下文中一共展示了JXTable.setRowHeight方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: interactiveXLabelRenderer
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Quick example of using a JXLabel as rendering component.
* Looks funny .. wrapping jumps?
*/
public void interactiveXLabelRenderer() {
DefaultTableModel model = new DefaultTableModel(0, 1);
model.addRow(new String[] {"some really, maybe really really long text - "
+ "wrappit .... where needed "});
model.addRow(new String[] {"another really, maybe really really long text - "
+ "with nothing but junk. wrappit .... where needed"});
JXTable table = new JXTable(model);
table.setVisibleRowCount(4);
table.setVisibleColumnCount(2);
table.setColumnControlVisible(true);
table.getColumnExt(0).setCellRenderer(new DefaultTableRenderer(new XLabelProvider()));
table.addHighlighter(
HighlighterFactory.createAlternateStriping());
table.setRowHeight(50);
showWithScrollingInFrame(table, "textArea as rendering comp");
}
示例2: interactiveTableAlternateAndHyperlink
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Classic lineprinter striping and hyperlink (LF only, no action).
*
*/
public void interactiveTableAlternateAndHyperlink() {
JXTable table = new JXTable(tableModel);
table.setRowHeight(22);
table.getColumn(1).setCellRenderer(
new DefaultTableRenderer(new HyperlinkProvider()));
table.addHighlighter(HighlighterFactory
.createSimpleStriping(HighlighterFactory.CLASSIC_LINE_PRINTER));
JFrame frame = wrapWithScrollingInFrame(table,
"classic lineprinter and hyperlink on column 1");
frame.setVisible(true);
}
示例3: interactiveTableAlternateAndRollover
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* LinePrinter striping and rollover.
*
*/
public void interactiveTableAlternateAndRollover() {
JXTable table = new JXTable(tableModel);
table.setRowHeight(22);
table.setHighlighters(
HighlighterFactory.createSimpleStriping(HighlighterFactory.LINE_PRINTER),
new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, Color.YELLOW, null));
showWithScrollingInFrame(table, "LinePrinter plus yellow rollover");
}
示例4: updateRowHeight
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Sets per-row rowHeight based on the rendering component's preferred height.
*
* @param table
*/
private void updateRowHeight(final JXTable table) {
for (int row = 0; row < table.getRowCount(); row++) {
int rowHeight = 0;
for (int column = 0; column < table.getColumnCount(); column++) {
Component comp = table.prepareRenderer(table
.getCellRenderer(row, column), row, column);
rowHeight = Math.max(rowHeight,
comp.getPreferredSize().height);
}
table.setRowHeight(row, rowHeight);
}
}
示例5: interactivePerRowImage
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Use custom painter and highlighter for per-row image decoration.
*
* @throws IOException
*/
public void interactivePerRowImage() throws IOException {
JXTable table = new JXTable(new AncientSwingTeam());
table.setForeground(Color.MAGENTA);
table.setSelectionForeground(Color.BLUE);
table.setColumnControlVisible(true);
table.setRowHeight(25);
final BufferedImage moon = XTestUtils.loadDefaultImage("moon.jpg");
final BufferedImage rocket = XTestUtils.loadDefaultImage("500by500.png");
HighlightPredicate rocketPredicate = new HighlightPredicate() {
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
return ((Integer) adapter.getValue(3)).intValue() < 50;
}
};
HighlightPredicate moonPredicate = new NotHighlightPredicate(rocketPredicate);
table.setHighlighters(
new SubImagePainterHighlighter(rocketPredicate,
new SubImagePainter(rocket))
,
new SubImagePainterHighlighter(moonPredicate,
new SubImagePainter(moon))
);
JXFrame frame = wrapWithScrollingInFrame(table, "painter in renderer");
show(frame);
}
示例6: main
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* It will all be done here.
*
* @param args will be ignored
*/
public static void main(String[] args) {
table = new JXTable(new SampleTableModel());
table.setRowHeight(2, 46);
setLookAndFeel();
setColumnAlignments();
addIconsToSomeColumns();
final JXCollapsiblePane collapsible = connectCollapsibleFindBarWithTable();
installTheMatchingTextHighlighter();
JCheckBox rightToLeftSwitch = createComponentOrientationSwitch();
buildGui(collapsible, rightToLeftSwitch);
callTheRobots();
}
示例7: interactiveAnimatedBusyPainterHighlight
import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
* Use highlighter with BusyPainter.
*/
public void interactiveAnimatedBusyPainterHighlight() {
TableModel model = new AncientSwingTeam();
JXTable table = new JXTable(model);
table.getColumn(0).setCellRenderer(new DefaultTableRenderer(
new HyperlinkProvider()));
final BusyPainter busyPainter = new BusyPainter() {
/**
* Overridden to fix Issue #861-swingx: must notify on change
* @param frame
*/
// @Override
// public void setFrame(int frame) {
// int old = getFrame();
// super.setFrame(frame);
// firePropertyChange("frame", old, getFrame());
// }
};
// JW: how do we ask for the height of the painter?
table.setRowHeight(26);
PainterHighlighter iconHighlighter = new PainterHighlighter();
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
return
adapter.convertRowIndexToModel(adapter.row) == 1;
}
};
iconHighlighter.setHighlightPredicate(predicate); //HighlightPredicate.ROLLOVER_ROW);
iconHighlighter.setPainter(busyPainter);
ActionListener l = new ActionListener() {
public void actionPerformed(ActionEvent e) {
int frame = busyPainter.getFrame();
frame = (frame+1)%busyPainter.getPoints();
busyPainter.setFrame(frame);
}
};
table.getColumnExt(1).addHighlighter(iconHighlighter);
showWithScrollingInFrame(table,
"Animated highlighter: BusyPainter on Rollover");
Timer timer = new Timer(100, l);
timer.start();
}