项目:Pogamut3
文件:PureMapTopComponent.java
/**
* When server changes,get message
* @param changedValue
*/
@Override
public void flagChanged(IUnrealServer server) {
SwingUtilities.invokelater(new Runnable() {
@Override
public void run() {
removeAll();
handleServerName();
if (serverDef.getServerFlag().getFlag() == null) {
add(new Label("Server not available ...",Label.CENTER),java.awt.BorderLayout.CENTER);
} else {
setUpMapPanel();
}
revalidate();
repaint();
}
}); /*
String msg = "Map changed to " + changedValue.getName() + " " + changedValue.getName();
JOptionPane.showMessageDialog(this,msg);
*/
}
private void init(Component parent,String title,String message,String buttonText) {
Panel p = new Panel();
add("Center",new Label(message));
Button btn = new Button(buttonText);
btn.addActionListener(this);
p.add(btn);
add("South",p);
pack();
Dimension dDim = getSize();
if (parent != null) {
Rectangle fRect = parent.getBounds();
setLocation(fRect.x + ((fRect.width - dDim.width) / 2),fRect.y + ((fRect.height - dDim.height) / 2));
}
}
/**
* Default constructor.
*/
protected CalculatorGUI()
{
super("Calculator");
setSize(720,540);
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent windowEvent)
{
setVisible(false);
dispose();
System.exit(0);
}
});
setLayout(new BorderLayout());
add(new CalculatorAWT(),BorderLayout.norTH);
add(new Label(),BorderLayout.soUTH);
setVisible(true);
}
项目:jdk8u-jdk
文件:WPrinterJob.java
private void init(Component parent,fRect.y + ((fRect.height - dDim.height) / 2));
}
}
项目:jdk8u-jdk
文件:MultiResolutionCursorTest.java
public void start() {
//Get things going. Request focus,set size,et cetera
setSize(200,200);
setVisible(true);
validate();
final Image image = new MultiResolutionCursor();
int center = sizes[0] / 2;
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
image,new Point(center,center),"multi-resolution cursor");
Frame frame = new Frame("Test Frame");
frame.setSize(300,300);
frame.setLocation(300,50);
frame.add(new Label("Move cursor here"));
frame.setCursor(cursor);
frame.setVisible(true);
}
项目:openjdk-jdk10
文件:WPrinterJob.java
private void init(Component parent,fRect.y + ((fRect.height - dDim.height) / 2));
}
}
项目:openjdk-jdk10
文件:ChildWindowProperties.java
public void testChildPropertiesWithDialogAsParent() {
parentDialog = new Dialog((Dialog) null,"parent Dialog");
parentDialog.setSize(WIDTH,HEIGHT);
parentDialog.setLocation(100,100);
parentDialog.setBackground(Color.RED);
parentLabel = new Label("ParentForegroundAndFont");
parentFont = new Font("Courier New",Font.ITALIC,15);
parentDialog.setForeground(Color.BLUE);
parentDialog.setFont(parentFont);
parentDialog.add(parentLabel);
parentDialog.setVisible(true);
windowChild = new Window(parentDialog);
windowChild.setSize(WIDTH,HEIGHT);
windowChild.setLocation(WIDTH + 200,100);
childLabel = new Label("ChildForegroundAndFont");
windowChild.add(childLabel);
windowChild.setVisible(true);
if (parentDialog.getBackground() == windowChild.getBackground()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Dialog's Background Color");
}
if (parentDialog.getForeground() == windowChild.getForeground()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Dialog's Foreground Color");
}
if (parentDialog.getFont() == windowChild.getFont()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Dialog's Font Color");
}
}
项目:openjdk-jdk10
文件:ChildWindowProperties.java
public void testChildPropertiesWithFrameAsParent() {
parentFrame = new Frame("parent Frame");
parentFrame.setSize(WIDTH,HEIGHT);
parentFrame.setLocation(100,400);
parentFrame.setBackground(Color.BLUE);
parentLabel = new Label("ParentForegroundAndFont");
parentFont = new Font("Courier New",15);
parentFrame.setForeground(Color.RED);
parentFrame.setFont(parentFont);
parentFrame.add(parentLabel);
parentFrame.setVisible(true);
frameChildWindow = new Window(parentFrame);
frameChildWindow.setSize(WIDTH,HEIGHT);
frameChildWindow.setLocation(WIDTH + 200,400);
childLabel = new Label("ChildForegroundAndFont");
frameChildWindow.add(childLabel);
frameChildWindow.setVisible(true);
if (parentFrame.getBackground() == frameChildWindow.getBackground()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Frame's Background Color");
}
if (parentDialog.getForeground() == windowChild.getForeground()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Frame's Foreground Color");
}
if (parentDialog.getFont() == windowChild.getFont()) {
dispose();
throw new RuntimeException("Child Window Should NOT Inherit "
+ "Parent Frame's Font Color");
}
}
项目:openjdk-jdk10
文件:MultiResolutionCursorTest.java
public void start() {
//Get things going. Request focus,200);
setVisible(true);
validate();
final Image image = new BaseMultiResolutionImage(
createResolutionVariant(0),createResolutionVariant(1),createResolutionVariant(2),createResolutionVariant(3)
);
int center = sizes[0] / 2;
Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor(
image,50);
frame.add(new Label("Move cursor here"));
frame.setCursor(cursor);
frame.setVisible(true);
}
项目:openjdk9
文件:WPrinterJob.java
private void init(Component parent,fRect.y + ((fRect.height - dDim.height) / 2));
}
}
项目:openjdk9
文件:MultiResolutionCursorTest.java
public void start() {
//Get things going. Request focus,50);
frame.add(new Label("Move cursor here"));
frame.setCursor(cursor);
frame.setVisible(true);
}
项目:Advanced-Java-Tools
文件:Installer.java
public PanelSeleDir(String scname,final File defDir)
{
this.add(new Label("Select a folder to install "+scname+"."));
selector = new FileSelector(defDir,JFileChooser.DIRECTORIES_ONLY);
selector.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if(e.getSource().equals(selector))
{
selected_dir = selector.getSelectedFile();
}
System.out.println(e);
}
});
this.add(selector);
// Todo Auto-generated constructor stub
}
项目:ipst
文件:OMCPane.java
/**
* This method initializes jPanel1
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel1() {
if (jPanel1 == null) {
label = new Label();
label.setText("Expression:");
jPanel1 = new JPanel();
JPanel jPanelX = new JPanel();
jPanelX.setLayout(new BoxLayout(jPanelX,BoxLayout.X_AXIS));
jPanelX.add(label,null);
jPanelX.add(getJTextField(),null);
jPanelX.add(getJButton(),null);
jPanelX.add(getJDemoButton(),null);
JPanel jPanelY = new JPanel();
jPanelY.setLayout(new BoxLayout(jPanelY,BoxLayout.Y_AXIS));
jPanelY.add(jPanelX);
Label helpLabel = new Label();
helpLabel.setText("Use <ENTER> or press Send to send the command,<Up>/<Down> keys for command history." +
" Press Demo for a quick demonstration of available OMC commands.");
jPanelY.add(helpLabel,null);
jPanel1.add(jPanelY);
}
return jPanel1;
}
项目:2048-Game-PC
文件:Sample2048GUI.java
public void setColor(Label l,int value)
{
l.setText(value+"");
l.setFont(new java.awt.Font("Arial",1,60));
if(value==0)
{
l.setText("");
l.setBackground(Color.white);
}
else if(value==2)
l.setBackground(Color.yellow);
else if(value==4)
l.setBackground(Color.orange);
else if(value==8)
l.setBackground(Color.cyan);
else if(value==16)
l.setBackground(Color.green);
else if(value==32)
l.setBackground(Color.pink);
else if(value==64)
l.setBackground(Color.red);
else if(value==128)
l.setBackground(Color.blue);
else if(value==256)
l.setBackground(Color.magenta);
else if(value==512)
l.setBackground(Color.lightGray);
else if(value==1024)
l.setBackground(Color.darkGray);
else if(value==2048)
l.setBackground(Color.black);
if(value>64)
l.setFont(new java.awt.Font("Arial",45));
if(value>512)
l.setFont(new java.awt.Font("Arial",30));
}
项目:aya-lang
文件:PiGUI.java
/**
* Default constructor.
*/
protected PiGUI()
{
super("Pi calculator");
setSize(720,540);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent windowEvent)
{
setVisible(false);
dispose();
System.exit(0);
}
});
setLayout(new BorderLayout());
this.statusLabel = new Label();
add(getContents(),BorderLayout.norTH);
add(this.statusLabel,BorderLayout.soUTH);
setVisible(true);
}
/**
* Default constructor.
*/
protected CalculatorGUI()
{
super("Calculator");
setSize(720,540);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent windowEvent)
{
setVisible(false);
dispose();
System.exit(0);
}
});
setLayout(new BorderLayout());
add(new CalculatorAWT(),BorderLayout.soUTH);
setVisible(true);
}
/**
* Draws a text into a boundary. The text is clipped on the right border of the bounds.
*
* @param g The graphics context in which to draw
* @param text The text to draw
* @param x The x position of the boundary
* @param y The y position of the boundary
* @param width The width position of the boundary
* @param height The height position of the boundary
* @param alignment The alignment of the text: Label.LEFT or Label.CENTER
* @param textDescent Text text descent
*/
public static void drawTextInBounds (final Graphics2D g,final String text,final int x,final int y,final int width,final int height,final int alignment,final int textDescent)
{
if (text == null || text.length () == 0)
return;
final Dimension dim = getTextDims (g,text);
g.clipRect (x,y,width,height);
final int pos;
switch (alignment)
{
case Label.LEFT:
pos = x;
break;
case Label.CENTER:
default:
pos = x + (width - dim.width) / 2;
break;
}
g.drawString (text,pos,y + height - (height - dim.height) / 2 - textDescent);
g.setClip (null);
}
/**
* Draws a menu at the top of the element.
*
* @param gc The graphics context
* @param left The left bound of the menus drawing area
* @param width The width of the menu
* @param layoutSettings The layout settings to use
*/
protected void drawMenu (final Graphics2D gc,final int left,final LayoutSettings layoutSettings)
{
final Color borderColor = layoutSettings.getBorderColor ();
if (this.menuName == null || this.menuName.length () == 0)
{
// Remove the 2 pixels of the prevIoUs menus border line
gc.setColor (borderColor);
gc.fillRect (left - SEParaTOR_SIZE,MENU_HEIGHT - 2,SEParaTOR_SIZE,1);
return;
}
final Color textColor = layoutSettings.getTextColor ();
gc.setColor (this.isMenuSelected ? textColor : borderColor);
gc.fillRect (left,MENU_HEIGHT - 1);
gc.setColor (textColor);
gc.fillRect (left,width + SEParaTOR_SIZE,1);
gc.setColor (this.isMenuSelected ? borderColor : textColor);
gc.setFont (layoutSettings.getTextFont (UNIT));
drawTextInBounds (gc,this.menuName,left,UNIT + SEParaTOR_SIZE,Label.CENTER);
}
/** {@inheritDoc} */
@Override
public void draw (final Graphics2D gc,final LayoutSettings layoutSettings)
{
final int size = this.items.size ();
final int itemHeight = disPLAY_HEIGHT / size;
final Color textColor = layoutSettings.getTextColor ();
final Color borderColor = layoutSettings.getBorderColor ();
for (int i = 0; i < size; i++)
{
final Pair<String,Boolean> item = this.items.get (i);
final boolean isSelected = item.getValue ().booleanValue ();
final int itemLeft = left + SEParaTOR_SIZE;
final int itemTop = i * itemHeight;
final int itemWidth = width - SEParaTOR_SIZE;
gc.setColor (isSelected ? textColor : borderColor);
gc.fillRect (itemLeft,itemTop + SEParaTOR_SIZE,itemWidth,itemHeight - 2 * SEParaTOR_SIZE);
gc.setColor (isSelected ? borderColor : textColor);
gc.setFont (layoutSettings.getTextFont (itemHeight / 2));
drawTextInBounds (gc,item.getKey (),itemLeft + INSET,itemTop,itemWidth - 2 * INSET,itemHeight,Label.LEFT);
}
}
项目:jdk8u_jdk
文件:WPrinterJob.java
private void init(Component parent,fRect.y + ((fRect.height - dDim.height) / 2));
}
}
项目:jdk8u_jdk
文件:MultiResolutionCursorTest.java
public void start() {
//Get things going. Request focus,50);
frame.add(new Label("Move cursor here"));
frame.setCursor(cursor);
frame.setVisible(true);
}
项目:lookaside_java-1.8.0-openjdk
文件:WPrinterJob.java
private void init(Component parent,fRect.y + ((fRect.height - dDim.height) / 2));
}
}
项目:lookaside_java-1.8.0-openjdk
文件:MultiResolutionCursorTest.java
public void start() {
//Get things going. Request focus,50);
frame.add(new Label("Move cursor here"));
frame.setCursor(cursor);
frame.setVisible(true);
}
项目:javify
文件:Demo.java
public void init ()
{
initted = true;
Panel p = new Panel();
p.setLayout (new GridLayout (3,1));
((GridLayout) p.getLayout ()).setHgap (5);
((GridLayout) p.getLayout ()).setVgap (5);
p.add (new Label ("left justified label",Label.LEFT));
p.add (new Label ("center justified label",Label.CENTER));
p.add (new Label ("right justified label",Label.RIGHT));
add (p,"Center");
Button cb = new Button ("Close");
cb.addActionListener(new ActionListener () {
public void actionPerformed (ActionEvent e) {
dispose();
}
});
add (cb,"South");
setTitle ("Labels");
pack();
}
项目:javify
文件:SwingLabelPeer.java
/**
* Sets the horizontal alignment of the label. This is implemented to
* set the alignment on the Swing label.
*
* @param alignment the horizontal alignment
*
* @see Label#LEFT
* @see Label#RIGHT
* @see Label#CENTER
*/
public void setAlignment(int alignment)
{
JLabel swingLabel = (JLabel) swingComponent.getJComponent();
switch (alignment)
{
case Label.RIGHT:
swingLabel.setHorizontalAlignment(JLabel.RIGHT);
break;
case Label.CENTER:
swingLabel.setHorizontalAlignment(JLabel.CENTER);
break;
case Label.LEFT:
default:
swingLabel.setHorizontalAlignment(JLabel.LEFT);
break;
}
}
项目:CraftPlugins
文件:Gui.java
public static void main(String[] args) {
Label label=new Label();
JLabel jlabel=new JLabel();
Gui f = new Gui();
JTextField textField = new JTextField(20);
f.setVisible(true);
f.setSize(800,500);
f.setTitle("Blockode控制台");
f.setLayout(new FlowLayout());
label.setLocation(0,0);
label.setText("插件日志:");
jlabel.setText(jlabel.getText()+"载入成功!");
jlabel.setBackground(Color.black);
jlabel.setLocation(10,6);
//textField.append("1");
f.add(label);
f.add(jlabel);
f.add(textField);
//再加上这一句就可以把Frame放在最中间了
f.setLocationRelativeto(null);
//如果没有这一句,在点击关闭Frame的时候程序其实还是在执行状态中的,加上这一句才算是真正的把资源释放掉了
f.setDefaultCloSEOperation(WindowConstants.disPOSE_ON_CLOSE);
}
项目:code-similarity
文件:TiledImageComponent.java
/** Set things up nicely. */
public TiledImageComponent() {
setLayout(new FlowLayout());
add(new Label("Name:",Label.CENTER));
add(nameTF=new TextField(10));
add(new Label("Password:",Label.CENTER));
add(passtF=new TextField(10));
passtF.setEchoChar('*');
add(new Label("Domain:",Label.CENTER));
add(domainTF=new TextField(10));
im = getToolkit().getimage(DEFAULT_IMAGE_NAME);
}
项目:trashjam2017
文件:AppletGameContainer.java
/**
* Create a new panel to display the console output
*
* @param e The exception causing the console to be displayed
*/
public ConsolePanel(Exception e) {
setLayout(new BorderLayout());
setBackground(Color.black);
setForeground(Color.white);
Font consoleFont = new Font("Arial",Font.BOLD,14);
Label slickLabel = new Label("SLICK CONSOLE",Label.CENTER);
slickLabel.setFont(consoleFont);
add(slickLabel,BorderLayout.PAGE_START);
StringWriter sw = new StringWriter();
e.printstacktrace(new PrintWriter(sw));
textArea.setText(sw.toString());
textArea.setEditable(false);
add(textArea,BorderLayout.CENTER);
// add a border on both sides of the console
add(new Panel(),BorderLayout.LINE_START);
add(new Panel(),BorderLayout.LINE_END);
Panel bottomPanel = new Panel();
bottomPanel.setLayout(new GridLayout(0,1));
Label infoLabel1 = new Label("An error occured while running the applet.",Label.CENTER);
Label infoLabel2 = new Label("Plese contact support to resolve this issue.",Label.CENTER);
infoLabel1.setFont(consoleFont);
infoLabel2.setFont(consoleFont);
bottomPanel.add(infoLabel1);
bottomPanel.add(infoLabel2);
add(bottomPanel,BorderLayout.PAGE_END);
}
项目:incubator-netbeans
文件:LabelBeanInfo.java
/** @return Propertydescriptors */
@Override
protected PropertyDescriptor[] createPDs() throws IntrospectionException {
PropertyDescriptor[] pds = new PropertyDescriptor[] {
new PropertyDescriptor("alignment",Label.class),// NOI18N
new PropertyDescriptor("text",// NOI18N
};
pds[0].setpropertyeditorClass(LabelBeanInfo.Alignmentpropertyeditor.class);
return pds;
}
项目:incubator-netbeans
文件:LabelBeanInfo.java
@Override
public void setAsText(String s) {
Integer i;
getTags();
if (s.equals(tags[0])) i = new Integer(java.awt.Label.LEFT);
else if (s.equals(tags[1])) i = new Integer(java.awt.Label.CENTER);
else i = new Integer(java.awt.Label.RIGHT);
setValue(i);
}
项目:incubator-netbeans
文件:LabelBeanInfo.java
@Override
public String getJavaInitializationString () {
int i = ((Integer) getValue()).intValue();
switch (i) {
case java.awt.Label.RIGHT : return "java.awt.Label.RIGHT"; // NOI18N
case java.awt.Label.LEFT : return "java.awt.Label.LEFT"; // NOI18N
default:
case java.awt.Label.CENTER : return "java.awt.Label.CENTER"; // NOI18N
}
}
/**
* Create a new panel to display the console output
*
* @param e The exception causing the console to be displayed
*/
public ConsolePanel(Exception e) {
setLayout(new BorderLayout());
setBackground(Color.black);
setForeground(Color.white);
Font consoleFont = new Font("Arial",BorderLayout.PAGE_END);
}
项目:Servlet_Applet_Communication
文件:LoginApplet.java
@Override
public void init() {
this.setVisible(true);
this.setSize(500,500);
this.setBackground(Color.green);
this.setLayout(new FlowLayout());
l1 = new Label("User Name");
l2 = new Label("Password");
tf1 = new TextField(20);
tf2 = new TextField(20);
tf2.setEchoChar('*');
b = new Button("Login");
b.addActionListener(this);
Font font = new Font("arial",25);
l1.setFont(font);
l2.setFont(font);
tf1.setFont(font);
tf2.setFont(font);
b.setFont(font);
this.add(l1);
this.add(tf1);
this.add(l2);
this.add(tf2);
this.add(b);
}
项目:BaseClient
文件:AppletGameContainer.java
/**
* Create a new panel to display the console output
*
* @param e The exception causing the console to be displayed
*/
public ConsolePanel(Exception e) {
setLayout(new BorderLayout());
setBackground(Color.black);
setForeground(Color.white);
Font consoleFont = new Font("Arial",BorderLayout.PAGE_END);
}
项目:jaer
文件:StereoMatchingFrame.java
/** Creates new form StereoMatchingViewer */
public StereoMatchingFrame(AEChip chip,int maxdisp) {
this.chip = chip;
this.maxdisp = maxdisp;
initComponents();
GridBagLayout layout = new GridBagLayout();
GridBagConstraints layoutConstraints = new GridBagConstraints();
layoutConstraints.anchor = GridBagConstraints.norTHWEST;
layoutConstraints.gridwidth = GridBagConstraints.REMAINDER;
setLayout(layout);
labeldisp = new Label("disparity: " + 0);
layout.setConstraints(labeldisp,layoutConstraints);
add(labeldisp);
labelSmc = new Label("Matching matrix");
layout.setConstraints(labelSmc,layoutConstraints);
add(labelSmc);
smc = new StereoMatchingCanvas(chip);
layout.setConstraints(smc,layoutConstraints);
add(smc);
labelScd = new Label("Accumulated disparity values");
layout.setConstraints(labelScd,layoutConstraints);
add(labelScd);
sdc = new StereodisparitiesCanvas(maxdisp);
layout.setConstraints(sdc,layoutConstraints);
add(sdc);
setPreferredSize(null);
pack();
}
public DitherControls(DitherTest app,int s,int e,DitherMethod type,boolean vertical) {
applet = app;
setLayout(dcLayout);
add(new Label(vertical ? "Vertical" : "Horizontal"));
add(choice = new Choice());
for (DitherMethod m : DitherMethod.values()) {
choice.addItem(m.toString().substring(0,1)
+ m.toString().substring(1).toLowerCase());
}
choice.select(type.ordinal());
add(start = new CardinalTextField(Integer.toString(s),4));
add(end = new CardinalTextField(Integer.toString(e),4));
}
/**
* 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;
}
}
@Override
protected void initThreads(Container container,GridBagConstraints constraints)
{
this.threadsLabel = new Label("Threads:");
container.add(this.threadsLabel,constraints);
this.threadsField = new TextField(ApfloatContext.getContext().getProperty(ApfloatContext.NUMBER_OF_PROCESSORS),5);
constraints.gridwidth = GridBagConstraints.REMAINDER;
container.add(this.threadsField,constraints);
}
项目:apfloat
文件:PiGUI.java
/**
* Default constructor.
*/
protected PiGUI()
{
super("Pi calculator");
setSize(720,540);
addWindowListener(new WindowAdapter()
{
@Override
public void windowClosing(WindowEvent windowEvent)
{
setVisible(false);
dispose();
System.exit(0);
}
});
setLayout(new BorderLayout());
this.statusLabel = new Label();
add(getContents(),BorderLayout.soUTH);
setVisible(true);
}
项目:jdk8u-jdk
文件:DitherTest.java
public DitherControls(DitherTest app,4));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。