本文整理了Java中javax.swing.JComponent.getToolkit()
方法的一些代码示例,展示了JComponent.getToolkit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.getToolkit()
方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:getToolkit
暂无
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private Point fitVertically( Point pt, JComponent parent, TabContainer tabContainer )
{
Point ptScreen = new Point( pt );
SwingUtilities.convertPointToScreen( ptScreen, parent );
int iDelta = pt.y + tabContainer.getHeight() - parent.getToolkit().getScreenSize().height;
if( iDelta > 0 )
{
pt.y -= iDelta;
}
return pt;
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
private Point fitHorizontally( Point pt, JComponent parent, TabContainer tabContainer )
{
Point ptScreen = new Point( pt );
SwingUtilities.convertPointToScreen( ptScreen, parent );
int iDelta = pt.x + tabContainer.getWidth() - parent.getToolkit().getScreenSize().width;
if( iDelta > 0 )
{
pt.x -= iDelta;
}
return pt;
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-editor
private Point fitVertically( Point pt, JComponent parent, TabContainer tabContainer )
{
Point ptScreen = new Point( pt );
SwingUtilities.convertPointToScreen( ptScreen, parent );
int iDelta = pt.y + tabContainer.getHeight() - parent.getToolkit().getScreenSize().height;
if( iDelta > 0 )
{
pt.y -= iDelta;
}
return pt;
}
代码示例来源:origin: org.gosu-lang.gosu/gosu-lab
private Point fitHorizontally( Point pt, JComponent parent, TabContainer tabContainer )
{
Point ptScreen = new Point( pt );
SwingUtilities.convertPointToScreen( ptScreen, parent );
int iDelta = pt.x + tabContainer.getWidth() - parent.getToolkit().getScreenSize().width;
if( iDelta > 0 )
{
pt.x -= iDelta;
}
return pt;
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
/**
* @param _comp a component if available, can be null
* @param _font a font
* @return the metrics of the font
*/
public static FontMetrics getFontMetrics(JComponent _comp, Font _font) {
Toolkit tk = null;
if (_comp != null) tk = _comp.getToolkit();
if (tk == null) tk = HELPER.getToolkit();
if (tk == null) tk = Toolkit.getDefaultToolkit();
return tk.getFontMetrics(_font);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void actionPerformed(ActionEvent evt) {
JComponent c = target;
if (c == null && (KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner() instanceof JComponent)) {
c = (JComponent) KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner();
}
if (c != null && c.isEnabled()) {
if (c instanceof EditableComponent) {
((EditableComponent) c).duplicate();
} else {
c.getToolkit().beep();
}
}
}
}
代码示例来源:origin: org.fudaa.framework.ebli/ebli-3d
t.setEnable(activee_.isSelected());
this.firePropertyChange("texture", null, t);
prevue_ = imageCompo_.getToolkit().createImage(filename);
final MediaTracker tracker = new MediaTracker(imageCompo_);
tracker.addImage(prevue_, 0);
代码示例来源:origin: MegaMek/megamek
private void setBackGround() {
UnitDisplaySkinSpecification udSpec = SkinXMLHandler
.getUnitDisplaySkin();
Image tile = comp.getToolkit()
.getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec
.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
int b = BackGroundDrawer.TILING_BOTH;
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec.getMechOutline())
.toString());
PMUtil.setImage(tile, comp);
b = BackGroundDrawer.NO_TILING | BackGroundDrawer.VALIGN_CENTER
| BackGroundDrawer.HALIGN_CENTER;
BackGroundDrawer bgd = new BackGroundDrawer(tile, b);
bgDrawers.addElement(bgd);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void actionPerformed(ActionEvent evt) {
JComponent c = target;
if (c == null && (KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner() instanceof JComponent)) {
c = (JComponent) KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner();
}
if (c != null && c.isEnabled()) {
if (c instanceof EditableComponent) {
((EditableComponent) c).selectAll();
} else if (c instanceof JTextComponent) {
((JTextComponent) c).selectAll();
} else {
c.getToolkit().beep();
}
}
}
@Override
代码示例来源:origin: MegaMek/megamek
private void setBackGround() {
UnitDisplaySkinSpecification udSpec = SkinXMLHandler
.getUnitDisplaySkin();
Image tile = comp.getToolkit()
.getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec
.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
int b = BackGroundDrawer.TILING_BOTH;
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec.getMechOutline())
.toString());
PMUtil.setImage(tile, comp);
b = BackGroundDrawer.NO_TILING | BackGroundDrawer.VALIGN_CENTER
| BackGroundDrawer.HALIGN_CENTER;
BackGroundDrawer bgd = new BackGroundDrawer(tile, b);
bgDrawers.addElement(bgd);
}
代码示例来源:origin: MegaMek/megamek
private void setBackGround() {
UnitDisplaySkinSpecification udSpec = SkinXMLHandler
.getUnitDisplaySkin();
Image tile = comp.getToolkit()
.getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec
.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
int b = BackGroundDrawer.TILING_BOTH;
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec.getMechOutline())
.toString());
PMUtil.setImage(tile, comp);
b = BackGroundDrawer.NO_TILING | BackGroundDrawer.VALIGN_CENTER
| BackGroundDrawer.HALIGN_CENTER;
BackGroundDrawer bgd = new BackGroundDrawer(tile, b);
bgDrawers.addElement(bgd);
}
代码示例来源:origin: MegaMek/megamek
private void setBackGround() {
UnitDisplaySkinSpecification udSpec = SkinXMLHandler
.getUnitDisplaySkin();
Image tile = comp.getToolkit()
.getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec
.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
int b = BackGroundDrawer.TILING_BOTH;
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(
new MegaMekFile(Configuration.widgetsDir(), udSpec.getMechOutline())
.toString());
PMUtil.setImage(tile, comp);
b = BackGroundDrawer.NO_TILING | BackGroundDrawer.VALIGN_CENTER
| BackGroundDrawer.HALIGN_CENTER;
BackGroundDrawer bgd = new BackGroundDrawer(tile, b);
bgDrawers.addElement(bgd);
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
@Override
public void actionPerformed(ActionEvent evt) {
JComponent c = target;
if (c == null && (KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner() instanceof JComponent)) {
c = (JComponent) KeyboardFocusManager.getCurrentKeyboardFocusManager().
getPermanentFocusOwner();
}
if (c != null && c.isEnabled()) {
if (c instanceof EditableComponent) {
((EditableComponent) c).clearSelection();
} else if (c instanceof JTextComponent) {
JTextComponent tc = ((JTextComponent) c);
tc.select(tc.getSelectionStart(), tc.getSelectionStart());
} else {
c.getToolkit().beep();
}
}
}
代码示例来源:origin: MegaMek/megamek
Image tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getLeftLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getRightLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLeftCorner()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLeftCorner()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopRightCorner()).toString());
代码示例来源:origin: MegaMek/megamek
Image tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getLeftLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getRightLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLeftCorner()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLeftCorner()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopRightCorner()).toString());
代码示例来源:origin: MegaMek/megamek
Image tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBackgroundTile()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getLeftLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getRightLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLeftCorner()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit()
.getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLeftCorner()).toString());
PMUtil.setImage(tile, comp);
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopRightCorner()).toString());
代码示例来源:origin: MegaMek/megamek
Image tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBackgroundTile()).toString()); //$NON-NLS-1$
PMUtil.setImage(tile, comp);
int b = BackGroundDrawer.TILING_BOTH;
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLine()).toString()); //$NON-NLS-1$
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getLeftLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getRightLine()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopLeftCorner()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getBottomLeftCorner()).toString());
PMUtil.setImage(tile, comp);
bgDrawers.addElement(new BackGroundDrawer(tile, b));
tile = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), udSpec.getTopRightCorner()).toString());
代码示例来源:origin: JetBrains/jediterm
public static synchronized void startModal(JComponent component, String key) {
try {
if (SwingUtilities.isEventDispatchThread()) {
EventQueue theQueue = component.getToolkit().getSystemEventQueue();
代码示例来源:origin: MegaMek/megamek
private void setAreas() {
FontMetrics fm = comp.getFontMetrics(FONT_VALUE);
battleArmorImage = comp.getToolkit().getImage(
new MegaMekFile(Configuration.widgetsDir(), "battle_armor.gif").toString()); //$NON-NLS-1$
PMUtil.setImage(battleArmorImage, comp);
for (int i = 0; i < BattleArmor.BA_MAX_MEN; i++) {
int shiftY = i * stepY;
unitAreas[i] = new PMPicArea(battleArmorImage);
unitAreas[i].translate(0, shiftY);
content.addArea(unitAreas[i]);
armorImage[i] = comp.createImage(105, 12);
armorAreas[i] = new PMPicArea(armorImage[i]);
armorAreas[i].translate(45, shiftY + 12);
content.addArea(armorAreas[i]);
armorLabels[i] = new PMValueLabel(fm, Color.red.brighter());
armorLabels[i].moveTo(160, shiftY + 24);
content.addArea(armorLabels[i]);
}
}
代码示例来源:origin: MegaMek/megamek
private void setAreas() {
int stepX = 30;
int stepY = 42;
infImage = comp.getToolkit().getImage(new MegaMekFile(Configuration.widgetsDir(), "inf.gif").toString()); //$NON-NLS-1$
PMUtil.setImage(infImage, comp);
for (int i = 0; i < Infantry.INF_PLT_MAX_MEN; i++) {
int shiftX = (i % 5) * stepX;
int shiftY = (i / 5) * stepY;
areas[i] = new PMPicArea(infImage);
areas[i].translate(shiftX, shiftY);
content.addArea(areas[i]);
}
FontMetrics fm = comp.getFontMetrics(FONT_VALUE);
armorLabel = new PMValueLabel(fm, Color.white);
armorLabel.setValue(Messages.getString(
"InfantryMapSet.Armor") + "XXXXXXXXXXXX"); //$NON-NLS-1$//$NON-NLS-2$
Dimension d = armorLabel.getSize();
content.translate(0, d.height + 5);
armorLabel.moveTo(0, d.height);
content.addArea(armorLabel);
label = new PMValueLabel(fm, Color.white);
label.setValue(Messages.getString(
"InfantryMapSet.InfantryPlatoon", new Object[] { "00" })); //$NON-NLS-1$//$NON-NLS-2$
d = label.getSize();
content.translate(0, d.height + 5);
label.moveTo(0, d.height);
content.addArea(label);
}
内容来源于网络,如有侵权,请联系作者删除!