本文整理了Java中java.awt.Label.setForeground()
方法的一些代码示例,展示了Label.setForeground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setForeground()
方法的具体详情如下:
包路径:java.awt.Label
类名称:Label
方法名:setForeground
暂无
代码示例来源:origin: wildfly/wildfly
err_msg.setBounds(new Rectangle(10, 200, 350, 30));
err_msg.setFont(new Font("Helvetica", Font.ITALIC, 12));
err_msg.setForeground(Color.red);
err_msg.setVisible(false);
get.setBounds(new Rectangle(10, 250, 80, 30));
代码示例来源:origin: net.preibisch/multiview-reconstruction
protected void update( final Label label )
{
label.setText( this.message );
label.setForeground( this.color );
}
代码示例来源:origin: net.jxta/jxta-jxse
@Override
public void mouseClicked(MouseEvent e) {
helpLabel.setForeground(Color.black);
helpLabel.setText("See \"http://jxta-jxse.dev.java.net/confighelp.html\" for config help");
}
});
代码示例来源:origin: net.jxta/jxta-jxse
private boolean verifyPort(String portName, String ports, boolean dynamicok) {
int p1;
if ((null == ports) || (0 == ports.trim().length())) {
ports = "0";
}
try {
p1 = Integer.parseInt(ports);
} catch (Exception ex) {
helpLabel.setForeground(Color.red.darker());
helpLabel.setText(portName + " port number must be an integer: " + ports);
return false;
}
if ((p1 > 65535) || (p1 < (dynamicok ? 0 : 1))) {
helpLabel.setForeground(Color.red.darker());
helpLabel.setText(
portName + " port number must be an integer between " + (dynamicok ? "0" : "1") + " and 65535, found " + p1);
return false;
}
return true;
}
代码示例来源:origin: imagej/ImageJA
String getSize(double inSpacing, double outSpacing, int count) {
int size = getOutputStackSize(inSpacing, outSpacing, count);
int mem = getAvailableMemory();
String available = mem!=-1?" ("+mem+"MB free)":"";
if (message!=null)
message.setForeground(mem!=-1&&size>mem?Color.red:Color.black);
if (size>0)
return size+"MB"+available;
else
return "<1MB"+available;
}
代码示例来源:origin: net.imagej/ij
String getSize(double inSpacing, double outSpacing, int count) {
int size = getOutputStackSize(inSpacing, outSpacing, count);
int mem = getAvailableMemory();
String available = mem!=-1?" ("+mem+"MB free)":"";
if (message!=null)
message.setForeground(mem!=-1&&size>mem?Color.red:Color.black);
if (size>0)
return size+"MB"+available;
else
return "<1MB"+available;
}
代码示例来源:origin: net.preibisch/multiview-reconstruction
@Override
public void textValueChanged(TextEvent arg0)
{
int downsampling = Integer.parseInt( downsample.getText() );
final long numPixels = FusionTools.numPixels( dim, downsampling );
final long megabytes = (numPixels * 4) / (1024*1024);
label.setText( "Image size for segmentation: " +
(dim[ 0 ])/downsampling + " x " +
(dim[ 1 ])/downsampling + " x " +
(dim[ 2 ])/downsampling + " pixels, " + megabytes + " MB" );
label.setForeground( GUIHelper.good );
}
} );
代码示例来源:origin: net.preibisch/multiview-reconstruction
@Override
public void textValueChanged( final TextEvent t )
{
if ( t.getID() == TextEvent.TEXT_VALUE_CHANGED )
{
final String xmlFilename = tf.getText();
// try parsing if it ends with XML
tryParsing( xmlFilename, false );
label1.setText( lpq.message1 );
label2.setText( lpq.message2 );
label1.setForeground( lpq.color );
label2.setForeground( lpq.color );
}
}
});
代码示例来源:origin: net.preibisch/multiview-reconstruction
public void update()
{
boundingBox = boundingBoxChoice.getSelectedIndex();
downsampling = Integer.parseInt( downsampleField.getText() );
final BoundingBox bb = allBoxes.get( boundingBox );
final long numPixels = Math.round( FusionTools.numPixels( bb, downsampling ) );
final int bytePerPixel = 4;
final long megabytes = (numPixels * bytePerPixel) / (1024*1024);
label1.setText( "Fused image: " + megabytes + " MB, required total memory ~" + totalRAM( megabytes, bytePerPixel ) + " MB" );
label1.setForeground( GUIHelper.good );
final int[] min = bb.getMin().clone();
final int[] max = bb.getMax().clone();
label2.setText( "Dimensions: " +
Math.round( (max[ 0 ] - min[ 0 ] + 1)/downsampling ) + " x " +
Math.round( (max[ 1 ] - min[ 1 ] + 1)/downsampling ) + " x " +
Math.round( (max[ 2 ] - min[ 2 ] + 1)/downsampling ) + " pixels @ " + FusionGUI.pixelTypes[ 0 ] );
}
代码示例来源:origin: net.jxta/jxta-jxse
private boolean verifyAddr(String proto, boolean serverOn, String localPort, String publicAddress, String publicPort) {
// if a public name is specified, check its port.
if (serverOn && (publicAddress.length() > 0)) {
if (!verifyPort(proto + " local", localPort, false)) {
helpLabel.setForeground(Color.red.darker());
helpLabel.setText("Dynamic tcp port selection not supported when server public address is specified.");
pages.showPage("Advanced");
return false;
}
if (!verifyPort(proto + " public", publicPort, false)) {
pages.showPage("Advanced");
helpLabel.setForeground(Color.red.darker());
helpLabel.setText("Dynamic tcp port selection not supported for server public address.");
return false;
}
} else if (!verifyPort(proto + " local", localPort, true)) {
pages.showPage("Advanced");
return false;
}
return true;
}
代码示例来源:origin: org.jacorb/jacorb
public void _setSelected(boolean selected) {
if (selected) {
getInnerPanel().setBackground(java.awt.Color.darkGray);
getObjectLabel().setBackground(java.awt.Color.darkGray);
getServantLabel().setBackground(java.awt.Color.darkGray);
getObjectLabel().setForeground(java.awt.Color.white);
getServantLabel().setForeground(java.awt.Color.white);
} else {
getInnerPanel().setBackground(java.awt.Color.lightGray);
getObjectLabel().setBackground(java.awt.Color.lightGray);
getServantLabel().setBackground(java.awt.Color.lightGray);
getObjectLabel().setForeground(java.awt.Color.black);
getServantLabel().setForeground(java.awt.Color.black);
}
}
void _setWidth(int w1, int w2) {
代码示例来源:origin: net.preibisch/multiview-reconstruction
public void update()
{
try
{
min[ 0 ] = Long.parseLong( minX.getText() );
min[ 1 ] = Long.parseLong( minY.getText() );
min[ 2 ] = Long.parseLong( minZ.getText() );
max[ 0 ] = Long.parseLong( maxX.getText() );
max[ 1 ] = Long.parseLong( maxY.getText() );
max[ 2 ] = Long.parseLong( maxZ.getText() );
}
catch (Exception e ) {}
final int bytePerPixel = 4;
final int downsampling = 1;
final long numPixels = FusionTools.numPixels( min, max, downsampling );
final long megabytes = (numPixels * bytePerPixel) / (1024*1024);
label1.setText( "Fused image: " + megabytes + " MB" );
label1.setForeground( GUIHelper.good );
label2.setText( "Dimensions: " +
(max[ 0 ] - min[ 0 ] + 1)/downsampling + " x " +
(max[ 1 ] - min[ 1 ] + 1)/downsampling + " x " +
(max[ 2 ] - min[ 2 ] + 1)/downsampling + " pixels @ 32 bit and full resolution." );
}
}
代码示例来源:origin: org.jacorb/jacorb
public void _setSelected(boolean selected) {
if (selected) {
getInnerPanel().setBackground(java.awt.Color.darkGray);
getRequestLabel().setBackground(java.awt.Color.darkGray);
getObjectLabel().setBackground(java.awt.Color.darkGray);
getRequestLabel().setForeground(java.awt.Color.white);
getObjectLabel().setForeground(java.awt.Color.white);
} else {
getInnerPanel().setBackground(java.awt.Color.lightGray);
getRequestLabel().setBackground(java.awt.Color.lightGray);
getObjectLabel().setBackground(java.awt.Color.lightGray);
getRequestLabel().setForeground(java.awt.Color.black);
getObjectLabel().setForeground(java.awt.Color.black);
}
}
void _setWidth(int w1, int w2) {
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the StateLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getStateLabel() {
if (ivjStateLabel == null) {
try {
ivjStateLabel = new java.awt.Label();
ivjStateLabel.setName("StateLabel");
ivjStateLabel.setText(" State:");
ivjStateLabel.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjStateLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label1 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getRegisterLabel() {
if (ivjRegisterLabel == null) {
try {
ivjRegisterLabel = new java.awt.Label();
ivjRegisterLabel.setName("RegisterLabel");
ivjRegisterLabel.setText("Registered POA's:");
ivjRegisterLabel.setBackground(java.awt.SystemColor.control);
ivjRegisterLabel.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjRegisterLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label3 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel3() {
if (ivjLabel3 == null) {
try {
ivjLabel3 = new java.awt.Label();
ivjLabel3.setName("Label3");
ivjLabel3.setFont(new java.awt.Font("dialog", 2, 10));
ivjLabel3.setAlignment(java.awt.Label.CENTER);
ivjLabel3.setText("Thread Pool");
ivjLabel3.setBounds(90, 22, 62, 12);
ivjLabel3.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjLabel3;
}
FillLevelBar _getThreadPoolBar() {
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the NameLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getNameLabel() {
if (ivjNameLabel == null) {
try {
ivjNameLabel = new java.awt.Label();
ivjNameLabel.setName("NameLabel");
ivjNameLabel.setText("State:");
ivjNameLabel.setBounds(10, 10, 50, 23);
ivjNameLabel.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjNameLabel;
}
Label _getStateLabel() {
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label1 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel1() {
if (ivjLabel1 == null) {
try {
ivjLabel1 = new java.awt.Label();
ivjLabel1.setName("Label1");
ivjLabel1.setFont(new java.awt.Font("dialog", 2, 10));
ivjLabel1.setAlignment(java.awt.Label.CENTER);
ivjLabel1.setText("Request Processing");
ivjLabel1.setBounds(10, 10, 140, 12);
ivjLabel1.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjLabel1;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label2 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel2() {
if (ivjLabel2 == null) {
try {
ivjLabel2 = new java.awt.Label();
ivjLabel2.setName("Label2");
ivjLabel2.setFont(new java.awt.Font("dialog", 2, 10));
ivjLabel2.setAlignment(java.awt.Label.CENTER);
ivjLabel2.setText("Active Requests");
ivjLabel2.setBounds(4, 22, 80, 12);
ivjLabel2.setForeground(java.awt.Color.black);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjLabel2;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label1 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLabel1() {
if (ivjLabel1 == null) {
try {
ivjLabel1 = new java.awt.Label();
ivjLabel1.setName("Label1");
ivjLabel1.setLocation(10, 10);
ivjLabel1.setText("Active Object");
ivjLabel1.setBackground(java.awt.SystemColor.control);
ivjLabel1.setSize(70, 12);
ivjLabel1.setForeground(java.awt.Color.black);
ivjLabel1.setFont(new java.awt.Font("dialog", 2, 10));
ivjLabel1.setAlignment(1);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjLabel1;
}
/**
内容来源于网络,如有侵权,请联系作者删除!