當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。