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


Java Font.DIALOG屬性代碼示例

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


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

示例1: main

public static void main(String args[]) {

        Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
        String text = "hello world";
        FontRenderContext frc = new FontRenderContext(null, false, false);
        TextLayout tl1 = new TextLayout(text, font, frc);
        TextLayout tl2 = new TextLayout(text, font, frc);
        if (tl1.equals(tl2) ||
            tl2.equals(tl1) ||
            tl1.equals((Object)tl2) ||
            tl2.equals((Object)tl1))
        {
             throw new RuntimeException("Equal TextLayouts");
        }
        if (!tl1.equals(tl1) ||
            !tl1.equals((Object)tl1))
        {
             throw new RuntimeException("Non-Equal TextLayouts");
        }
    }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:TextLayoutEqualsTest.java

示例2: makeText

private static void makeText(Graphics2D graphics, ImageSize maxSize, Random rand) {
	switchColor(graphics, rand);
	
	String fontName = Font.SANS_SERIF;
	switch (rand.nextInt(4)) {
		case 0: fontName = Font.SANS_SERIF; break;
		case 1: fontName = Font.MONOSPACED; break;
		case 2: fontName = Font.SERIF; break;
		case 3: fontName = Font.DIALOG; break;
	}
	
	int fontStyle = Font.PLAIN;
	switch (rand.nextInt(3)) {
		case 0: fontStyle = Font.PLAIN; break;
		case 1: fontStyle = Font.BOLD; break;
		case 2: fontStyle = Font.ITALIC; break;
	}
	
	int fontSize = rand.nextInt(MAX_FONT_SIZE + 1);
	
	graphics.setFont(new Font(fontName, fontStyle, fontSize));
	
	int textLength = rand.nextInt(MAX_TEXT_LENGTH + 1);
	String str = Stream.generate(() -> rand.nextInt(MAX_CHAR_SIZE))
			.limit(textLength)
			.map(i -> (char)i.intValue())
			.collect(StringBuilder::new, StringBuilder::append, StringBuilder::append).toString();
	
	graphics.drawString(str, rand.nextInt(maxSize.getWidth()), rand.nextInt(maxSize.getHeight()));
}
 
開發者ID:DescartesResearch,項目名稱:Pet-Supply-Store,代碼行數:30,代碼來源:ImageCreator.java

示例3: getFont

protected Font getFont(Component c) {
    Font font = getTitleFont();
    if (font != null) {
        return font;
    }
    if (c != null) {
        font = c.getFont();
        if (font != null) {
            return font;
        }
    }
    return new Font(Font.DIALOG, Font.PLAIN, 12);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:TitledBorder.java

示例4: getFont

/**
 * Returns default font of the titled border.
 * @return default font of the titled border
 * @param c the component
 */
protected Font getFont(Component c) {
    Font font = getTitleFont();
    if (font != null) {
        return font;
    }
    if (c != null) {
        font = c.getFont();
        if (font != null) {
            return font;
        }
    }
    return new Font(Font.DIALOG, Font.PLAIN, 12);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:TitledBorder.java

示例5: SelectionBar

public SelectionBar()
{
	super();

	Messenger.register(MT.TIMER_SERVICE_CONNECTION, this);
	Messenger.register(MT.SERIES_CHANGED, this);
	Messenger.register(MT.NEW_CHALLENGE, this);
	Messenger.register(MT.CHALLENGE_DELETED, this);

	setBorder(new BevelBorder(0));

	Font f = new Font(Font.DIALOG, Font.BOLD, 14);

	seriesLabel = new CurrentSeriesLabel();
	seriesLabel.setFont(f.deriveFont(Font.PLAIN));
	challengeSelect  = createCombo("challengeChange");
	eventSelect = createCombo("eventChange");
	
	connectLabel = new JLabel("Not Connected");
	connectLabel.setForeground(Color.RED);
	connectLabel.setFont(f);

	add(createLabel("Series:", f));
	add(seriesLabel);
	add(Box.createHorizontalStrut(40));

	add(createLabel("Event:", f));
	add(eventSelect);
	add(Box.createHorizontalStrut(40));

	add(createLabel("Challenge:", f));
	add(challengeSelect);
	add(Box.createHorizontalStrut(15));
	
	add(createLabel("Timer:", f));
	add(connectLabel);
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:37,代碼來源:SelectionBar.java

示例6: SelectionBar

public SelectionBar()
{
    super();

    Messenger.register(MT.SERIES_CHANGED, this);

    setLayout(new MigLayout("ins 2, center, gap 4"));
    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);
    eventSelect = new JComboBox<Event>();
    eventSelect.setActionCommand("eventChange");
    eventSelect.addActionListener(this);

    lock = new JCheckBox("Lock");
    lock.setActionCommand("lockEvent");
    lock.addActionListener(this);

    JLabel dl = new JLabel("Series:");
    dl.setFont(f);
    JLabel el = new JLabel("Event:");
    el.setFont(f);

    add(dl, "");
    add(new CurrentSeriesLabel(), "");
    add(el, "gap left 25");
    add(eventSelect, "");
    add(lock, "");
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:29,代碼來源:SelectionBar.java

示例7: EntrantRenderer

public EntrantRenderer()
{
	super();
	background = new Color(240, 240, 240);
	backgroundSelect = new Color(120, 120, 120);
	backgroundError = new Color(255, 120, 120);
	backgroundErrorSelect = new Color(230, 100, 100);
	topLine = null;
	bottomLine = null;

	topFont = new Font(Font.DIALOG, Font.BOLD, 11);
	bottomFont = new Font(Font.DIALOG, Font.PLAIN, 11);
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:13,代碼來源:DriverTable.java

示例8: getInstalledFontFamilyNames

/**
 * Get a list of installed fonts in the requested {@link Locale}.
 * The list contains the fonts Family Names.
 * If Locale is null, the default locale is used.
 *
 * @param requestedLocale, if null the default locale is used.
 * @return list of installed fonts in the system.
 */
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
    if (requestedLocale == null) {
        requestedLocale = Locale.getDefault();
    }
    if (allFamilies != null && lastDefaultLocale != null &&
        requestedLocale.equals(lastDefaultLocale)) {
            String[] copyFamilies = new String[allFamilies.length];
            System.arraycopy(allFamilies, 0, copyFamilies,
                             0, allFamilies.length);
            return copyFamilies;
    }

    TreeMap<String,String> familyNames = new TreeMap<String,String>();
    //  these names are always there and aren't localised
    String str;
    str = Font.SERIF;         familyNames.put(str.toLowerCase(), str);
    str = Font.SANS_SERIF;    familyNames.put(str.toLowerCase(), str);
    str = Font.MONOSPACED;    familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG;        familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG_INPUT;  familyNames.put(str.toLowerCase(), str);

    /* Platform APIs may be used to get the set of available family
     * names for the current default locale so long as it is the same
     * as the start-up system locale, rather than loading all fonts.
     */
    if (requestedLocale.equals(getSystemStartupLocale()) &&
        getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
        /* Augment platform names with JRE font family names */
        getJREFontFamilyNames(familyNames, requestedLocale);
    } else {
        loadFontFiles();
        Font2D[] physicalfonts = getPhysicalFonts();
        for (int i=0; i < physicalfonts.length; i++) {
            if (!(physicalfonts[i] instanceof NativeFont)) {
                String name =
                    physicalfonts[i].getFamilyName(requestedLocale);
                familyNames.put(name.toLowerCase(requestedLocale), name);
            }
        }
    }

    // Add any native font family names here
    addNativeFontFamilyNames(familyNames, requestedLocale);

    String[] retval =  new String[familyNames.size()];
    Object [] keyNames = familyNames.keySet().toArray();
    for (int i=0; i < keyNames.length; i++) {
        retval[i] = (String)familyNames.get(keyNames[i]);
    }
    if (requestedLocale.equals(Locale.getDefault())) {
        lastDefaultLocale = requestedLocale;
        allFamilies = new String[retval.length];
        System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
    }
    return retval;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:64,代碼來源:SunFontManager.java

示例9: getInstalledFontFamilyNames

/**
 * Get a list of installed fonts in the requested {@link Locale}.
 * The list contains the fonts Family Names.
 * If Locale is null, the default locale is used.
 *
 * @param requestedLocale, if null the default locale is used.
 * @return list of installed fonts in the system.
 */
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
    if (requestedLocale == null) {
        requestedLocale = Locale.getDefault();
    }
    if (allFamilies != null && lastDefaultLocale != null &&
        requestedLocale.equals(lastDefaultLocale)) {
            String[] copyFamilies = new String[allFamilies.length];
            System.arraycopy(allFamilies, 0, copyFamilies,
                             0, allFamilies.length);
            return copyFamilies;
    }

    TreeMap<String,String> familyNames = new TreeMap<String,String>();
    //  these names are always there and aren't localised
    String str;
    str = Font.SERIF;         familyNames.put(str.toLowerCase(), str);
    str = Font.SANS_SERIF;    familyNames.put(str.toLowerCase(), str);
    str = Font.MONOSPACED;    familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG;        familyNames.put(str.toLowerCase(), str);
    str = Font.DIALOG_INPUT;  familyNames.put(str.toLowerCase(), str);

    /* Platform APIs may be used to get the set of available family
     * names for the current default locale so long as it is the same
     * as the start-up system locale, rather than loading all fonts.
     */
    if (requestedLocale.equals(getSystemStartupLocale()) &&
        getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
        /* Augment platform names with JRE font family names */
        getJREFontFamilyNames(familyNames, requestedLocale);
    } else {
        loadFontFiles();
        Font2D[] physicalfonts = getPhysicalFonts();
        for (int i=0; i < physicalfonts.length; i++) {
            if (!(physicalfonts[i] instanceof NativeFont)) {
                String name =
                    physicalfonts[i].getFamilyName(requestedLocale);
                familyNames.put(name.toLowerCase(requestedLocale), name);
            }
        }
    }

    // Add any native font family names here
    addNativeFontFamilyNames(familyNames, requestedLocale);

    String[] retval =  new String[familyNames.size()];
    Object [] keyNames = familyNames.keySet().toArray();
    for (int i=0; i < keyNames.length; i++) {
        retval[i] = familyNames.get(keyNames[i]);
    }
    if (requestedLocale.equals(Locale.getDefault())) {
        lastDefaultLocale = requestedLocale;
        allFamilies = new String[retval.length];
        System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
    }
    return retval;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:64,代碼來源:SunFontManager.java

示例10: main

public static void main(String[] args) {
    System.setProperty("java2d.font.usePlatformFont", "true");
    Font f = new Font(Font.DIALOG,Font.PLAIN,12);
    Toolkit tk = Toolkit.getDefaultToolkit();
    tk.getFontMetrics(f);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:6,代碼來源:FontCrash.java

示例11: SelectionBar

public SelectionBar()
{
    super(new MigLayout("fill, ins 3", "fill"));

    Messenger.register(MT.SERIES_CHANGED, this);
    Messenger.register(MT.RUNGROUP_CHANGED, this);
    Messenger.register(MT.ENTRANTS_CHANGED, this);
    setBorder(new BevelBorder(0));

    Font f = new Font(Font.DIALOG, Font.BOLD, 14);
    Font fn = f.deriveFont(Font.PLAIN);

    resultsButton = new JButton("Print Current Group Results");
    resultsButton.addActionListener(this);
    resultsButton.setActionCommand("resultsPrint");

    refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(e -> Messenger.sendEvent(MT.RUNGROUP_CHANGED, null));

    seriesLabel = new CurrentSeriesLabel();
    seriesLabel.setFont(fn);
    entrantCountLabel = new JLabel("0");
    entrantCountLabel.setFont(fn);

    courseSelect = createCombo("courseChange");
    groupSelect  = createCombo("groupChange");
    eventSelect = createCombo("eventChange");

    groupSelect.setModel(new DefaultComboBoxModel<Integer>(new Integer[] { 1, 2, 3, 4, 5, 6 }));

    add(createLabel("Series:", f), "gapleft 10");
    add(seriesLabel, "gapright 20");

    add(createLabel("Event:", f), "");
    add(eventSelect, "gapright 20");

    add(createLabel("Course:", f));
    add(courseSelect, "gapright 10");

    add(createLabel("RunGroup:", f));
    add(groupSelect, "gapright 10");

    add(createLabel("Count:", f));
    add(entrantCountLabel, "");

    add(new JLabel(""), "growx 100, pushx 100");

    add(refreshButton, "");
    add(resultsButton, "gapright 20");
}
 
開發者ID:drytoastman,項目名稱:scorekeeperfrontend,代碼行數:50,代碼來源:SelectionBar.java

示例12: XDMTheme

public XDMTheme() {
	fontResource = new FontUIResource(new Font(Font.DIALOG, Font.PLAIN, 12));
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:3,代碼來源:XDMTheme.java

示例13: init

private void init() {
	setTitle(getString("CONFIG_TITLE"));
	setIconImage(XDMIconMap.getIcon("APP_ICON").getImage());
	setUndecorated(true);
	setSize(500, 400);
	plainFont = new Font(Font.DIALOG, Font.PLAIN, 12);
	boldFont = new Font(Font.DIALOG, Font.BOLD | Font.ITALIC, 12);

	clickHandler = new ConfigMouseAdapter();
	centerPanel = new JPanel(new BorderLayout());
	centerPanel.setBorder(new LineBorder(Color.BLACK));
	add(centerPanel);
	createLeftPanel();
	createRightPanel();

	cardLayout = new CardLayout();

	cardPanel = new JPanel(cardLayout);
	cardPanel.setBackground(Color.white);

	pane.add(cardPanel);// createGeneralPanel());

	cardPanel.add(createGeneralPanel(), getString("CONFIG_LBL1"));

	cardPanel.add(createConnectionPanel(), getString("CONFIG_LBL2"));

	cardPanel.add(createSaveToPanel(), getString("CONFIG_LBL3"));

	cardPanel.add(createAdvancedPanel(), getString("CONFIG_LBL4"));

	cardPanel.add(createProxyPanel(), getString("CONFIG_LBL5"));

	cardPanel.add(createTypesPanel(), getString("CONFIG_LBL6"));

	cardPanel.add(createCredentialPanel(), getString("CONFIG_LBL7"));

	cardPanel.add(createSchedulerPanel(), getString("CONFIG_LBL8"));

	cardPanel.add(createExceptionsPanel(), getString("CONFIG_LBL9"));

	showPanel(getString("CONFIG_LBL1"));
}
 
開發者ID:kmarius,項目名稱:xdman,代碼行數:42,代碼來源:ConfigDialog.java


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