當前位置: 首頁>>代碼示例>>Java>>正文


Java JXTable.packAll方法代碼示例

本文整理匯總了Java中org.jdesktop.swingx.JXTable.packAll方法的典型用法代碼示例。如果您正苦於以下問題:Java JXTable.packAll方法的具體用法?Java JXTable.packAll怎麽用?Java JXTable.packAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jdesktop.swingx.JXTable的用法示例。


在下文中一共展示了JXTable.packAll方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: interactiveTableBorderHighlighter

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Show variants of border Highlighters.
 *
 */
public void interactiveTableBorderHighlighter() {
    JXTable table = new JXTable(tableModel);
    table.setVisibleRowCount(table.getRowCount());
    table.setVisibleColumnCount(7);
    table.packAll();
    table.setColumnControlVisible(true);
    
    BorderHighlighter outer = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(1),
            BorderFactory.createLineBorder(Color.RED, 3));
    BorderHighlighter inner = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(2),
            BorderFactory.createLineBorder(Color.RED, 3), true, true);
    BorderHighlighter replace = new BorderHighlighter(new HighlightPredicate.ColumnHighlightPredicate(0),
            BorderFactory.createLineBorder(Color.RED, 3), false, true);
    table.setHighlighters(outer, inner, replace);
    showWithScrollingInFrame(table, "Border Highlighters");
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:21,代碼來源:HighlighterClientVisualCheck.java

示例2: interactiveTablePatternHighlighterJP

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Multiple Highlighters (shown as example in Javapolis 2007).
 * 
 */
public void interactiveTablePatternHighlighterJP() {
    JXTable table = new JXTable(tableModel);
    table.setVisibleRowCount(table.getRowCount());
    table.setVisibleColumnCount(7);
    table.packAll();
    table.setColumnControlVisible(true);

    Font font = table.getFont().deriveFont(Font.BOLD | Font.ITALIC);
    Highlighter simpleStriping = HighlighterFactory.createSimpleStriping();
    PatternPredicate patternPredicate = new PatternPredicate("^M", 1);
    ColorHighlighter magenta = new ColorHighlighter(patternPredicate, null,
            Color.MAGENTA, null, Color.MAGENTA);
    FontHighlighter derivedFont = new FontHighlighter(patternPredicate,
            font);
    AbstractHighlighter gradient = createRelativeGradientHighlighter(HorizontalAlignment.LEFT, AncientSwingTeam.INTEGER_COLUMN);
    gradient.setHighlightPredicate(new HighlightPredicate.ColumnHighlightPredicate(AncientSwingTeam.INTEGER_COLUMN));
    
    LOG.info("" + (table.getValueAt(0, 3) instanceof Number));
    Highlighter shading = new ShadingColorHighlighter(
            new HighlightPredicate.ColumnHighlightPredicate(1));

    table.setHighlighters(simpleStriping, magenta, derivedFont, shading //);
            , gradient);
    showWithScrollingInFrame(table, "Multiple Highlighters");
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:30,代碼來源:HighlighterClientVisualCheck.java

示例3: testPackColumnNullHeader

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue ??: NPE in pack for null table header.
 *
 */
@Test
public void testPackColumnNullHeader() {
    JXTable table = new JXTable(new AncientSwingTeam());
    table.setTableHeader(null);
    table.packAll();
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:11,代碼來源:ColumnFactoryTest.java

示例4: testPackMargin

import org.jdesktop.swingx.JXTable; //導入方法依賴的package包/類
/**
 * Issue #266-swingx: support customization of pack margin.
 * 
 * added property to ColumnFactory. 
 *  
 */
@Test
public void testPackMargin() {
    final int special = 1;
    JXTable table = new JXTable(1, 2);
    ColumnFactory factory = new ColumnFactory();
    table.setColumnFactory(factory);
    table.setValueAt("something that's wider than 75", 0, special);
    TableColumnExt columnExt = table.getColumnExt(special);
    table.packAll();
    TableCellRenderer renderer = table.getCellRenderer(0, special);
    Component comp = table.prepareRenderer(renderer, 0, special);
    int realPrefWidth = 2 * factory.getDefaultPackMargin() // magic value - JXTable's default margin, 
                              //  needs to be made configurable, see Issue 266 
        + comp.getPreferredSize().width;
    // sanity - default margin kicks in
    assertEquals(realPrefWidth, columnExt.getPreferredWidth());
    
    int margin = 10;
    factory.setDefaultPackMargin(margin);
    table.packAll();
    table.prepareRenderer(renderer, 0, special);
    int otherPrefWidth = 2 * margin + comp.getPreferredSize().width;
    assertEquals(otherPrefWidth, columnExt.getPreferredWidth());
    
    
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:33,代碼來源:ColumnFactoryTest.java


注:本文中的org.jdesktop.swingx.JXTable.packAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。