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


Java SwingConstants.LEFT属性代码示例

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


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

示例1: initComponents

private void initComponents() {
    setOpaque(false);
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 4, 5));

    JPanel legendPanel = new JPanel(new FlowLayout(FlowLayout.TRAILING, 5, 0));
    legendPanel.setOpaque(false);

    gcRootLegend = new JLabel(Bundle.ClassesListController_GcRootString(), BrowserUtils.ICON_GCROOT, SwingConstants.LEFT);
    gcRootLegendDivider = new JLabel("|"); // NOI18N

    legendPanel.add(new JLabel(Bundle.ClassesListController_ArrayTypeString(), BrowserUtils.ICON_ARRAY, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_ObjectTypeString(), BrowserUtils.ICON_INSTANCE, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_PrimitiveTypeString(), BrowserUtils.ICON_PRIMITIVE, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(new JLabel(Bundle.ClassesListController_StaticFieldString(), BrowserUtils.ICON_STATIC, SwingConstants.LEFT));
    legendPanel.add(new JLabel("|")); // NOI18N
    legendPanel.add(gcRootLegend);
    legendPanel.add(gcRootLegendDivider);
    legendPanel.add(new JLabel(Bundle.ClassesListController_LoopString(), BrowserUtils.ICON_LOOP, SwingConstants.LEFT));

    //add(new JLabel("Legend:"), BorderLayout.WEST);
    add(legendPanel, BorderLayout.EAST);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:LegendPanel.java

示例2: alignRectsRunFor

protected void alignRectsRunFor(final Rectangle[] rects, final Dimension tabPaneSize, final int tabPlacement, final boolean isRightToLeft) {
    final boolean isVertical = tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT;

    if (isVertical) {
        if (needsScrollers) {
            stretchScrollingVerticalRun(rects, tabPaneSize);
        } else {
            centerVerticalRun(rects, tabPaneSize);
        }
    } else {
        if (needsScrollers) {
            stretchScrollingHorizontalRun(rects, tabPaneSize, isRightToLeft);
        } else {
            centerHorizontalRun(rects, tabPaneSize, isRightToLeft);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:AquaTabbedPaneTabState.java

示例3: paintBorder

/**
 * Draws the component border.
 *
 * @param graphics
 *            the graphics context
 */
void paintBorder(Graphics graphics) {
	Graphics2D g = (Graphics2D) graphics.create();
	g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	g.setColor(Colors.BUTTON_BORDER);

	int radius = RapidLookAndFeel.CORNER_DEFAULT_RADIUS;
	switch (position) {
		case SwingConstants.LEFT:
			g.drawRoundRect(0, 0, button.getWidth() + radius, button.getHeight() - 1, radius, radius);
			break;
		case SwingConstants.CENTER:
			g.drawRect(0, 0, button.getWidth() + radius, button.getHeight() - 1);
			break;
		default:
			g.drawRoundRect(-radius, 0, button.getWidth() + radius - 1, button.getHeight() - 1, radius, radius);
			g.drawLine(0, 0, 0, button.getHeight());
			break;
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:CompositeButtonPainter.java

示例4: FooterBar

public FooterBar() {
	
	setPreferredSize(new Dimension(640, 16));
	setLayout(new GridLayout());
	setBorder(new BevelBorder(BevelBorder.LOWERED));
	
	Border margin = new EmptyBorder(0, 5, 0, 5);
	
	label = new JLabel("Ready", SwingConstants.LEFT);
	label.setBorder(margin);
	add(label);
	
	progress = new JProgressBar();
	progress.setMaximum(6);
	progress.setStringPainted(true);
	progress.setPreferredSize(new Dimension(10, 16));
	progress.setValue(0);
	add(progress);
	
}
 
开发者ID:condolent,项目名称:USB3Installer,代码行数:20,代码来源:FooterBar.java

示例5: LabelFrame

public LabelFrame()
{
   super("Testing JLabel");
   setLayout(new FlowLayout()); // set frame layout

   // JLabel constructor with a string argument
   label1 = new JLabel("Label with text");
   label1.setToolTipText("This is label1");
   add(label1); // add label1 to JFrame

   // JLabel constructor with string, Icon and alignment arguments
   Icon bug = new ImageIcon(getClass().getResource("bug1.png"));
   label2 = new JLabel("Label with text and icon", bug, 
      SwingConstants.LEFT);
   label2.setToolTipText("This is label2");
   add(label2); // add label2 to JFrame

   label3 = new JLabel(); // JLabel constructor no arguments
   label3.setText("Label with icon and text at bottom");
   label3.setIcon(bug); // add icon to JLabel
   label3.setHorizontalTextPosition(SwingConstants.CENTER);
   label3.setVerticalTextPosition(SwingConstants.BOTTOM);
   label3.setToolTipText("This is label3");
   add(label3); // add label3 to JFrame
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:25,代码来源:LabelFrame.java

示例6: TabLabel

/**
 * Creates a new tab label.
 * @param tabKind the kind of tab label
 * @param icon icon for the tab label
 * @param title text for the tab label
 */
private TabLabel(Kind tabKind, Icon icon, String title, boolean button) {
    super(new FlowLayout(FlowLayout.LEFT, 1, 0));
    setOpaque(false);
    setBorder(null);
    this.kind = tabKind;
    this.hasButton = button;
    this.iconLabel = new JLabel(title, icon, SwingConstants.LEFT);
    this.iconLabel.setBackground(Values.ERROR_COLOR);
    this.iconLabel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, tabKind.getHGap()));
    if (tabKind != Kind.RESOURCE) {
        this.iconLabel.setFont(this.iconLabel.getFont()
            .deriveFont(Font.BOLD));
    }
    add(this.iconLabel);
    if (button && title != null) {
        add(getButton());
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:24,代码来源:TabLabel.java

示例7: createTab

/**
 * Creates a tabpage title component with close button and registers it to
 * hidden tabs
 * 
 * @return the new tab
 */
private JPanel createTab(String title, Icon icon, final Component component) {
	JPanel tab = new JPanel(new BorderLayout(0, 0));
	tab.setOpaque(false);

	JLabel lbl = new JLabel(title, icon, SwingConstants.LEFT);
	tab.add(lbl, BorderLayout.WEST);

	return tab;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:15,代码来源:FloatingTabbedPane.java

示例8: isLeadingAlign

static boolean isLeadingAlign(Component component) {
    int alignment;
    
    if (component instanceof ProfilerRenderer) {
        alignment = ((ProfilerRenderer)component).getHorizontalAlignment();
    } else if (component instanceof JLabel) {
        alignment = ((JLabel)component).getHorizontalAlignment();
    } else {
        alignment = SwingConstants.LEADING;
    }
    
    return alignment == SwingConstants.LEADING ||
           alignment == SwingConstants.LEFT ||
           alignment == SwingConstants.CENTER;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ProfilerTable.java

示例9: ToggleButtonGroup

/**
 * Creates a new button group from the given Actions (requires at least two actions).
 *
 * @param preferredSize
 *            the preferredSize of the nested {@link CompositeToggleButton}s or {@code null}
 * @param actions
 *            the action
 */
public ToggleButtonGroup(Dimension preferredSize, Action... actions) {
	if (actions.length < 2) {
		throw new IllegalArgumentException("At least two primary actions must be specified.");
	}

	this.setOpaque(false);
	this.preferredSize = preferredSize;

	primaryButtons = new CompositeToggleButton[actions.length];
	for (int i = 0; i < actions.length; i++) {
		int position;
		if (i == 0) {
			position = SwingConstants.LEFT;
		} else if (i < actions.length - 1) {
			position = SwingConstants.CENTER;
		} else {
			position = SwingConstants.RIGHT;
		}
		primaryButtons[i] = new CompositeToggleButton(actions[i], position);
	}

	// align buttons left to right with no padding
	GridBagLayout layout = new GridBagLayout();
	setLayout(layout);

	GridBagConstraints gbc = new GridBagConstraints();
	gbc.insets = new Insets(0, 0, 0, 0);
	gbc.fill = GridBagConstraints.VERTICAL;
	gbc.weighty = 1;

	for (JToggleButton button : primaryButtons) {
		button.addActionListener(buttonChooser);
		if (preferredSize != null) {
			button.setMinimumSize(preferredSize);
			button.setPreferredSize(preferredSize);
		}
		add(button, gbc);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:47,代码来源:ToggleButtonGroup.java

示例10: WhoIsPanel

public WhoIsPanel(final ServiceFactory factory) {
	super(factory);
	final JPanel top = new JPanel();
	top.setLayout(new WrapLayout(FlowLayout.LEFT, 2, 0));
	_label = new JLabel("", SwingConstants.LEFT);
	top.add(_label);
	add(top, BorderLayout.NORTH);
	_textArea = new JTextArea("", 30, 70);
	_textArea.setEditable(false);
	final JScrollPane scroll = new JScrollPane(_textArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	add(scroll, BorderLayout.CENTER);
	_whois.addListener(this);
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:13,代码来源:WhoIsPanel.java

示例11: convertAlignment

/**
 * Converts {@code Label} alignment constant to the {@code JLabel} constant.
 * If wrong Label alignment provided returns default alignment.
 *
 * @param alignment {@code Label} constant.
 *
 * @return {@code JLabel} constant.
 */
private static int convertAlignment(final int alignment) {
    switch (alignment) {
        case Label.CENTER:
            return SwingConstants.CENTER;
        case Label.RIGHT:
            return SwingConstants.RIGHT;
        default:
            return SwingConstants.LEFT;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:LWLabelPeer.java

示例12: getListCellRendererComponent

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
	JLabel label = new JLabel(stationData.getStationName(value), JMTImageLoader.loadImage(stationData.getStationType(value) + "Combo"),
			SwingConstants.LEFT);
	label.setOpaque(true);
	label.setBorder(new LineBorder(cellHasFocus ? Color.BLUE : Color.WHITE));
	label.setBackground(isSelected ? list.getSelectionBackground() : Color.WHITE);
	label.setForeground(isSelected ? list.getSelectionForeground() : Color.BLACK);
	label.setFont(isSelected ? label.getFont().deriveFont(Font.BOLD) : label.getFont().deriveFont(Font.ROMAN_BASELINE));
	return label;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:AllStationsParametersPanel.java

示例13: getTableCellRendererComponent

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
	Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
	super.setHorizontalAlignment(SwingConstants.LEFT);
	if (!table.isCellEditable(row, 1)) {
		renderer.setEnabled(false);
	} else {
		renderer.setEnabled(true);
	}
	return renderer;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:11,代码来源:RoutingSectionPanel.java

示例14: createSlider

void createSlider(Method methodToCall, int min, int max, int init, String label) {
    JSlider slider = new MyJSlider(methodToCall, min, max, init, this.layout, this.item);
    slider.addChangeListener(this);
    JLabel sliderLabel = new JLabel(label, SwingConstants.LEFT);
    this.add(sliderLabel);
    this.add(slider);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:7,代码来源:LayoutKind.java

示例15: getPanel

private JPanel getPanel(int pos)
{
	JPanel panel = null;
	if( pos == SwingConstants.LEFT )
	{
		panel = left;
	}
	else
	{
		panel = right;
	}
	return panel;
}
 
开发者ID:equella,项目名称:Equella,代码行数:13,代码来源:JStatusBar.java


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