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


Java JLabel.LEADING属性代码示例

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


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

示例1: ProbePresenter

public ProbePresenter(TracerProbe p, TracerProbeDescriptor d) {
    super(d.getProbeName(), d.getProbeIcon(), JLabel.LEADING);
    
    // --- ToolTips support
    // Let's store the tooltip in client property and resolve it from parent
    putClientProperty("ToolTipHelper", d.getProbeDescription()); // NOI18N
    // ---
    
    setIconTextGap(7);
    setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createMatteBorder(0, 0, 1, 1, Color.LIGHT_GRAY),
                BorderFactory.createEmptyBorder(5, 10, 5, 10)
            ));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProbePresenter.java

示例2: ToggleButtonMenuItem

public ToggleButtonMenuItem(String text, Icon icon) {
    super(sizeText(text));
    setLayout(null);

    selectedIcon = createSelectedIcon(icon);
    unselectedIcon = createUnselectedIcon(icon);

    label = new JLabel(unselectedIcon, JLabel.LEADING);
    add(label, BorderLayout.WEST);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ToggleButtonMenuItem.java

示例3: initColumnsData

private void initColumnsData() {
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = Bundle.FieldsBrowserControllerUI_FieldColumnName();
        columnToolTips[0] = Bundle.FieldsBrowserControllerUI_FieldColumnDescr();

        columnNames[1] = Bundle.FieldsBrowserControllerUI_TypeColumnName();
        columnToolTips[1] = Bundle.FieldsBrowserControllerUI_TypeColumnDescr();

        columnNames[2] = Bundle.FieldsBrowserControllerUI_FullTypeColumnName();
        columnToolTips[2] = Bundle.FieldsBrowserControllerUI_FullTypeColumnDescr();

        columnNames[3] = Bundle.FieldsBrowserControllerUI_ValueColumnName();
        columnToolTips[3] = Bundle.FieldsBrowserControllerUI_ValueColumnDescr();

        columnNames[4] = Bundle.FieldsBrowserControllerUI_SizeColumnName();
        columnToolTips[4] = Bundle.FieldsBrowserControllerUI_SizeColumnDescr();

        if (retainedSizeSupported) {
            columnNames[5] = Bundle.FieldsBrowserControllerUI_RetainedSizeColumnName();
            columnToolTips[5] = Bundle.FieldsBrowserControllerUI_RetainedSizeColumnDescr();
        }

        int unitWidth = getFontMetrics(getFont()).charWidth('W'); // NOI18N // initial width of data columns

//        FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer(false);
//        treeCellRenderer.setLeafIcon(null);
//        treeCellRenderer.setClosedIcon(null);
//        treeCellRenderer.setOpenIcon(null);

        LabelTableCellRenderer dataCellRendererL = new LabelTableCellRenderer(JLabel.LEADING);
        LabelTableCellRenderer dataCellRendererT = new LabelTableCellRenderer(JLabel.TRAILING);

        // method / class / package name
        columnRenderers[0] = null;

        columnWidths[1 - 1] = unitWidth * 18;
        columnRenderers[1] = dataCellRendererL;

        columnWidths[2 - 1] = unitWidth * 28;
        columnRenderers[2] = dataCellRendererL;

        columnWidths[3 - 1] = unitWidth * 20;
        columnRenderers[3] = new FieldTableCellRenderer();

        columnWidths[4 - 1] = unitWidth * 7;
        columnRenderers[4] = dataCellRendererT;

        if (retainedSizeSupported) {
            columnWidths[5 - 1] = unitWidth * 7;
            columnRenderers[5] = dataCellRendererT;
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:FieldsBrowserControllerUI.java

示例4: initColumnsData

private void initColumnsData() {
        columnWidths = new int[columnCount - 1]; // Width of the first column fits to width
        columnNames = new String[columnCount];
        columnToolTips = new String[columnCount];
        columnRenderers = new TableCellRenderer[columnCount];

        columnNames[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnName();
        columnToolTips[0] = Bundle.ReferencesBrowserControllerUI_FieldColumnDescr();

        columnNames[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnName();
        columnToolTips[1] = Bundle.ReferencesBrowserControllerUI_TypeColumnDescr();

        columnNames[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnName();
        columnToolTips[2] = Bundle.ReferencesBrowserControllerUI_FullTypeColumnDescr();

        columnNames[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnName();
        columnToolTips[3] = Bundle.ReferencesBrowserControllerUI_ValueColumnDescr();

        columnNames[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnName();
        columnToolTips[4] = Bundle.ReferencesBrowserControllerUI_SizeColumnDescr();

        if (retainedSizeSupported) {
            columnNames[5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnName();
            columnToolTips[5] = Bundle.ReferencesBrowserControllerUI_RetainedSizeColumnDescr();
        }

        int unitWidth = getFontMetrics(getFont()).charWidth('W'); // NOI18N // initial width of data columns

//        FieldTreeCellRenderer treeCellRenderer = new FieldTreeCellRenderer();
//        treeCellRenderer.setLeafIcon(null);
//        treeCellRenderer.setClosedIcon(null);
//        treeCellRenderer.setOpenIcon(null);

        LabelTableCellRenderer dataCellRendererL = new LabelTableCellRenderer(JLabel.LEADING);
        LabelTableCellRenderer dataCellRendererT = new LabelTableCellRenderer(JLabel.TRAILING);

        // method / class / package name
        columnRenderers[0] = null;

        columnWidths[1 - 1] = unitWidth * 18;
        columnRenderers[1] = dataCellRendererL;

        columnWidths[2 - 1] = unitWidth * 28;
        columnRenderers[2] = dataCellRendererL;

        columnWidths[3 - 1] = unitWidth * 20;
        columnRenderers[3] = new FieldTableCellRenderer();

        columnWidths[4 - 1] = unitWidth * 7;
        columnRenderers[4] = dataCellRendererT;

        if (retainedSizeSupported) {
            columnWidths[5 - 1] = unitWidth * 7;
            columnRenderers[5] = dataCellRendererT;
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:ReferencesBrowserControllerUI.java

示例5: populatePopup

private void populatePopup() {
    JPanel content = new JPanel(new BorderLayout());
    
    JLabel hint = new JLabel(Bundle.ProjectsSelector_selectProjects(), JLabel.LEADING);
    hint.setBorder(BorderFactory.createEmptyBorder(0, 0, 6, 0));
    content.add(hint, BorderLayout.NORTH);

    final SelectedProjectsModel projectsModel = new SelectedProjectsModel();
    final ProfilerTable projectsTable = new ProfilerTable(projectsModel, true, false, null);
    projectsTable.setColumnToolTips(new String[] {
        Bundle.ProjectsSelector_columnSelectedToolTip(),
        Bundle.ProjectsSelector_columnProjectToolTip() });
    projectsTable.setMainColumn(1);
    projectsTable.setFitWidthColumn(1);
    projectsTable.setDefaultSortOrder(1, SortOrder.ASCENDING);
    projectsTable.setSortColumn(1);
    projectsTable.setFixedColumnSelection(0); // #268298 - make sure SPACE always hits the Boolean column
    projectsTable.setColumnRenderer(0, new CheckBoxRenderer());
    LabelRenderer projectRenderer = new ProjectRenderer();
    projectsTable.setColumnRenderer(1, projectRenderer);
    int w = new JLabel(projectsTable.getColumnName(0)).getPreferredSize().width;
    projectsTable.setDefaultColumnWidth(0, w + 15);
    int h = projectsTable.getRowHeight() * 8;
    h += projectsTable.getTableHeader().getPreferredSize().height;
    projectRenderer.setText("A longest expected project name A longest expected project name"); // NOI18N
    Dimension prefSize = new Dimension(w + projectRenderer.getPreferredSize().width, h);
    projectsTable.setPreferredScrollableViewportSize(prefSize);
    ProfilerTableContainer tableContainer = new ProfilerTableContainer(projectsTable, true, null);
    JPanel tableContent = new JPanel(new BorderLayout());
    tableContent.setBorder(BorderFactory.createEmptyBorder(0, 0, 4, 0));
    tableContent.add(tableContainer, BorderLayout.CENTER);
    content.add(tableContent, BorderLayout.CENTER);

    JToolBar controls = new FilteringToolbar(Bundle.ProjectsSelector_filterProjects()) {
        protected void filterChanged() {
            if (isAll()) projectsTable.setRowFilter(null);
            else projectsTable.setRowFilter(new RowFilter() {
                public boolean include(RowFilter.Entry entry) {
                    return passes(entry.getStringValue(1));
                }
            });
        }
    };

    content.add(controls, BorderLayout.SOUTH);

    panel = content;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:48,代码来源:ProjectsSelector.java

示例6: ProjectSelector

ProjectSelector() {
    projectListModel = new DefaultListModel();
    final FilteredListModel<Lookup.Provider> filteredProjects = new FilteredListModel<Lookup.Provider>(projectListModel) {
        protected boolean matchesFilter(Lookup.Provider proj, GenericFilter filter) {
            return filter.passes(ProjectUtilities.getDisplayName(proj));
        }
    };
    final HintRenderer hintRenderer = new HintRenderer();
    projectList = new JList(filteredProjects) {
        public Dimension getPreferredScrollableViewportSize() {
            Dimension dim = super.getPreferredScrollableViewportSize();
            dim.width = LIST_WIDTH;
            return dim;
        }
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            
            if (getModel().getSize() == 0) {
                hintRenderer.setup(true, getSize());
                hintRenderer.paint(g);
            }
        }
    };
    projectList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    filteredProjects.setSelectionModel(projectList.getSelectionModel());
    projectList.setCellRenderer(new DefaultListCellRenderer() {
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            DefaultListCellRenderer c = (DefaultListCellRenderer)super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            Lookup.Provider val = (Lookup.Provider)value;
            c.setText(ProjectUtilities.getDisplayName(val));
            c.setIcon(ProjectUtilities.getIcon(val));
            return c;
        }
    });
    projectList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent e) {
            if (!e.getValueIsAdjusting()) projectSelected();
        }
    });
    
    JLabel projectsLabel = new JLabel(Bundle.ClassMethodSelector_capProjects(), JLabel.LEADING);
    projectsLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
    JToolBar projectsTools = new FilteringToolbar(Bundle.ClassMethodSelector_lblFilterItems()) {
        protected void filterChanged() {
            filteredProjects.setFilter(getFilter());
        }
    };
    
    setOpaque(false);
    setLayout(new BorderLayout());
    add(projectsLabel, BorderLayout.NORTH);
    add(new JScrollPane(projectList), BorderLayout.CENTER);
    add(projectsTools, BorderLayout.SOUTH);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:54,代码来源:ClassMethodSelector.java


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