当前位置: 首页>>代码示例>>Java>>正文


Java JXFrame.add方法代码示例

本文整理汇总了Java中org.jdesktop.swingx.JXFrame.add方法的典型用法代码示例。如果您正苦于以下问题:Java JXFrame.add方法的具体用法?Java JXFrame.add怎么用?Java JXFrame.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jdesktop.swingx.JXFrame的用法示例。


在下文中一共展示了JXFrame.add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFindDialogDispose

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Issue #718-swingx: shared FindPanel not updated on LF change.
 * 
 * Here: check that containing dialog is disposed, new api with flag.
 */
@Test
public void testFindDialogDispose() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXFrame frame = new JXFrame();
    JXTable table = new JXTable();
    frame.add(table);
    JComponent findPanel = SearchFactory.getInstance().getSharedFindPanel();
    SearchFactory.getInstance().showFindDialog(table, table.getSearchable());
    Window window = SwingUtilities.getWindowAncestor(findPanel);
    assertSame(frame, window.getOwner());
    SearchFactory.getInstance().hideSharedFindPanel(true);
    assertFalse("window must not be displayable", window.isDisplayable());
    assertNull("findPanel must be unparented", findPanel.getParent());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:24,代码来源:FindTest.java

示例2: testFindDialogHide

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Issue #718-swingx: shared FindPanel not updated on LF change.
 * 
 * Here: check that containing dialog is not disposed.
 */
@Test
public void testFindDialogHide() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXFrame frame = new JXFrame();
    JXTable table = new JXTable();
    frame.add(table);
    JComponent findPanel = SearchFactory.getInstance().getSharedFindPanel();
    SearchFactory.getInstance().showFindDialog(table, table.getSearchable());
    Container parent = findPanel.getParent();
    Window window = SwingUtilities.getWindowAncestor(findPanel);
    assertSame(frame, window.getOwner());
    SearchFactory.getInstance().hideSharedFindPanel(false);
    assertFalse("window must not be visible", window.isVisible());
    assertSame("findPanel must parent must be unchanged", 
            parent, findPanel.getParent());
    assertTrue("window must be displayable", window.isDisplayable());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:27,代码来源:FindTest.java

示例3: testFindDialogNew

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Issue #718-swingx: shared FindPanel not updated on LF change.
 * 
 * Here: check that dialog is new for different owner and old has been disposed.
 */
@Test
public void testFindDialogNew() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXFrame frame = new JXFrame();
    JXTable table = new JXTable();
    frame.add(table);
    JComponent findPanel = SearchFactory.getInstance().getSharedFindPanel();
    // show search dialog for a searchable
    SearchFactory.getInstance().showFindDialog(table, table.getSearchable());
    Window window = SwingUtilities.getWindowAncestor(findPanel);
    assertSame(frame, window.getOwner());
    // setup of second searchable
    JXFrame second = new JXFrame();
    JXTree tree = new JXTree();
    second.add(tree);
    // show search dialog for a searchable
    SearchFactory.getInstance().showFindDialog(tree, tree.getSearchable());
    assertFalse("previous window must not be displayable", window.isDisplayable());
    assertSame(second, SwingUtilities.getWindowAncestor(findPanel).getOwner());
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:30,代码来源:FindTest.java

示例4: interactiveDatePickerCellEditorXTable

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
     * Issue ??-swingx: picker cell editor popup commit/cancel 
     * transfers focus out-off the table (1.5)
     * 
     * Looks like a core issue - editable combo misbehaves as well.
     * Here we use a JXTable.
     */
    public void interactiveDatePickerCellEditorXTable() {
        final JXTable table = new JXTable(createTableModel(2));
        table.setVisibleColumnCount(6);
//        table.setSurrendersFocusOnKeystroke(true);
        installEditors(table);
        Action action = new AbstractAction("toggle terminate") {

            public void actionPerformed(ActionEvent e) {
                table.setTerminateEditOnFocusLost(!table.isTerminateEditOnFocusLost());
                
            }
            
        };
        JXFrame frame = wrapWithScrollingInFrame(table, "JXTable - date picker cell editor");
        addAction(frame, action);
        frame.add(new JXDatePicker(), BorderLayout.SOUTH);
        show(frame);
    }
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:26,代码来源:DatePickerCellEditorVisualCheck.java

示例5: testMonthHeaderBoundsAtLocation

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * coordinate mapping: monthBounds in pixel.
 * 
 */
@Test
public void testMonthHeaderBoundsAtLocation() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXMonthView monthView = new JXMonthView();
    monthView.setTraversable(true);
    JXFrame frame = new JXFrame();
    frame.add(monthView);
    frame.pack();
    BasicMonthViewUI ui = (BasicMonthViewUI) monthView.getUI();
    Rectangle monthBoundsLToR = ui.getMonthHeaderBoundsAtLocation(20, 20);
    assertEquals("", ui.getMonthHeaderHeight(), monthBoundsLToR.height);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:BasicMonthViewUITest.java

示例6: getRealizedMonthViewUI

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Returns the ui of a realized JXMonthView with
 * given componentOrientation and showingWeekNumbers flag.
 * It's prefColumns/Rows are set to 2. The first displayedDate is 
 * 20. Feb. 2008 (to have fixed leading/trailing dates)
 * 
 * The frame is packed and it's size extended by 40, 40 to
 * give a slight off-position (!= 0) of the months shown. 
 * 
 * NOTE: this must not be used in a headless environment.
 * 
 * @param co the componentOrientation to use
 * @return
 */
private BasicMonthViewUI getRealizedMonthViewUI(ComponentOrientation co,
        boolean isShowingWeekNumbers) {
    JXMonthView monthView = new JXMonthView();
    monthView.setPreferredColumnCount(2);
    monthView.setPreferredRowCount(2);
    monthView.setComponentOrientation(co);
    monthView.setShowingWeekNumber(isShowingWeekNumbers);
    Calendar calendar = monthView.getCalendar();
    calendar.set(2008, Calendar.FEBRUARY, 20);
    monthView.setFirstDisplayedDay(calendar.getTime());
    JXFrame frame = new JXFrame();
    frame.add(monthView);
    frame.pack();
    frame.setSize(frame.getWidth() + 40, frame.getHeight() + 40);
    frame.setVisible(true);
    BasicMonthViewUI ui = (BasicMonthViewUI) monthView.getUI();
    return ui;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:33,代码来源:BasicMonthViewUITest.java

示例7: testGetDayAtLocation

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * cleanup date representation as long: new api getDayAtLocation. will
 * replace getDayAt which is deprecated as a first step.
 */
@Test
public void testGetDayAtLocation() {
    // This test will not work in a headless configuration.
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run test - headless environment");
        return;
    }
    JXMonthView monthView = new JXMonthView();
    monthView.getSelectionModel().setMinimalDaysInFirstWeek(1);
    JXFrame frame = new JXFrame();
    frame.add(monthView);
    frame.pack();
    Dimension pref = monthView.getPreferredSize();
    pref.width = pref.width / 2;
    pref.height = pref.height / 2;
    Date date = monthView.getDayAtLocation(pref.width, pref.height);
    assertNotNull(date);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:23,代码来源:BasicMonthViewUITest.java

示例8: getRealizedMonthViewUI

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Returns the ui of a realized JXMonthView with
 * given componentOrientation and showingWeekNumbers flag.
 * It's prefColumns/Rows are set to 2. The first displayedDate is 
 * 20. Feb. 2008 (to have fixed leading/trailing dates)
 * 
 * The frame is packed and it's size extended by 40, 40 to
 * give a slight off-position (!= 0) of the months shown. 
 * 
 * 
 * 
 * NOTE: this must not be used in a headless environment.
 * 
 * @param co the componentOrientation to use
 * @return
 */
private BasicMonthViewUI getRealizedMonthViewUI(ComponentOrientation co,
        boolean isShowingWeekNumbers) {
    JXMonthView monthView = new JXMonthView();
    monthView.setPreferredColumnCount(2);
    monthView.setPreferredRowCount(2);
    monthView.setComponentOrientation(co);
    monthView.setShowingWeekNumber(isShowingWeekNumbers);
    Calendar calendar = monthView.getCalendar();
    calendar.set(2008, Calendar.FEBRUARY, 20);
    monthView.setFirstDisplayedDay(calendar.getTime());
    JXFrame frame = new JXFrame();
    frame.add(monthView);
    frame.pack();
    frame.setSize(frame.getWidth() + 40, frame.getHeight() + 40);
    frame.setVisible(true);
    BasicMonthViewUI ui = (BasicMonthViewUI) monthView.getUI();
    return ui;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:35,代码来源:BasicMonthViewUIIssues.java

示例9: startup

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
@Override 
protected void startup() {
    
    configureDefaults();
    
    JXFrame frame = (JXFrame) getMainFrame();
    frame.add(createMainPanel());
    frame.setJMenuBar(createMenuBar());
    applyDefaults();
    installListeners();
    // PENDING JW: moved from start of method to after component creation
    // otherwise throws with bsaf-1.9.1
    // needs tracking - dont know what's happening ...
    StyledTextActions.install(getContext());
    
    show(frame);     
    demoSelector.setDefaultSelectedDemo();
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:19,代码来源:SwingXSet.java

示例10: getRealizedDatePicker

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * @return
 */
protected JXDatePicker getRealizedDatePicker() {
    JXFrame frame = new JXFrame();
    final JXDatePicker picker = new JXDatePicker();
    frame.add(new JTextField(10));
    frame.add(picker);
    frame.add(new JTextField(10));
    frame.pack();
    frame.setVisible(true);
    return picker;
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:14,代码来源:CompoundFocusListenerTest.java

示例11: interactiveDatePickerCellEditorTable

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Issue ??-swingx: picker cell editor popup commit/cancel 
 * transfers focus out-off the table (1.5)
 * 
 * Looks like a core issue - editable combo misbehaves as well.
 * Here we use a core table.
 */
public void interactiveDatePickerCellEditorTable() {
    JTable table = new JTable(createTableModel(2));
    table.putClientProperty("terminateEditOnFocusLost", true);
    installEditors(table);
    JXFrame frame = wrapWithScrollingInFrame(table, "JTable - date picker cell editor");
    frame.add(new JTextField("yet another thing to focus"), BorderLayout.SOUTH);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:16,代码来源:DatePickerCellEditorVisualCheck.java

示例12: createComponentHierarchyModel

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * @return
 */
private TreeModel createComponentHierarchyModel() {
    JXFrame frame = new JXFrame("dummy");
    frame.add(new JScrollPane(new JXTree()));
    return new ComponentTreeTableModel(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:9,代码来源:TreeRendererTest.java

示例13: interactiveDatePickerCellEditorXTree

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * Issue ??-swingx: picker cell editor popup commit/cancel 
 * transfers focus out-off the tree (1.5)
 * 
 * 
 * a) commit by keyboard - commit okay but focus moved where?
 * b) click into popup to commit - did not commit. 
 *    Now fixed (CellEditorRemover copes with popup) okay committed, 
 *    but focus where (as in a)?
 * c) click on month navigation - editing canceled fixed. 
 * d) click in month navigation, then cancel by keyboard - 
 *    focus where?
 *    
 * focus handling is done in BasicTreeUI.completeEditing - and
 * does not cope with popup. All termination is done in uidelegate,
 * no central method in the tree called.
 *      
 * independent on stopCellEditing flag - semantic in tree is
 * different from semantic in table (first is "how" to terminate, 
 * second is "if" to terminate)  
 *    
 */
public void interactiveDatePickerCellEditorXTree() {
    final JXTree tree = new JXTree(createTreeModelWithDates());
    tree.setEditable(true);
    tree.setCellEditor(new DefaultXTreeCellEditor(tree, null, new DatePickerCellEditor()));
    Action action = new AbstractAction("toggle terminate") {

        public void actionPerformed(ActionEvent e) {
            tree.setInvokesStopCellEditing(!tree.getInvokesStopCellEditing());
            
        }
        
    };
    JXFrame frame = wrapWithScrollingInFrame(tree, "JXTree - date picker cell editor");
    addAction(frame, action);
    frame.add(new JTextField("yet another thing to focus"), BorderLayout.SOUTH);
    show(frame);
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:40,代码来源:DatePickerCellEditorVisualCheck.java

示例14: showCalendarFrame

import org.jdesktop.swingx.JXFrame; //导入方法依赖的package包/类
/**
 * 
 */
public void showCalendarFrame() {
    calendarFrame = new JXFrame("Calendar 2010");
    calendarFrame.setName("calendar2010");
    calendarFrame.setDefaultCloseOperation(JXFrame.DO_NOTHING_ON_CLOSE);
    WindowListener l = new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            calendarFrame.removeWindowListener(this);
            hideCalendarFrame();
        }
        
    };
    calendarFrame.addWindowListener(l);
    JXPanel calendar = new JXPanel();
    calendar.setBackground(Color.WHITE);
    Painter<?> painter = createBackgroundPainter();
    calendar.setBackgroundPainter(painter);

    JXMonthView monthView = new JXMonthView();
    Calendar cal = monthView.getCalendar();
    cal.set(Calendar.YEAR, 2010);
    cal.set(Calendar.MONTH, Calendar.JANUARY);
    monthView.setFirstDisplayedDay(cal.getTime());
    monthView.setOpaque(false);
    monthView.setPreferredColumnCount(3);
    monthView.setPreferredRowCount(4);
    // old style: set visual property with JXMonthView api
    monthView.setDayForeground(Calendar.SUNDAY, Color.MAGENTA);
    // <snip> Custom CalendarRenderingHandler
    // new style: install a custom renderingHandler 
    // (as client property, because no public api support yet)
    // which allows to add Highlighters
    monthView.putClientProperty(DemoMonthViewUI.RENDERING_HANDLER_KEY, 
            createRenderingHandler());
    // </snip>
    DemoUtils.setSnippet("Custom CalendarRenderingHandler", monthView);
    calendar.add(monthView);
    calendarFrame.add(calendar);
    Application application = Application.getInstance(Application.class);
    if (application instanceof SingleFrameApplication) {
        ((SingleFrameApplication) application).show(calendarFrame);
    } else {
        calendarFrame.pack();
        calendarFrame.setLocationRelativeTo(this);
        calendarFrame.setVisible(true);
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:52,代码来源:MonthViewExtDemo.java


注:本文中的org.jdesktop.swingx.JXFrame.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。