本文整理了Java中java.awt.Label.setBackground()
方法的一些代码示例,展示了Label.setBackground()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setBackground()
方法的具体详情如下:
包路径:java.awt.Label
类名称:Label
方法名:setBackground
暂无
代码示例来源:origin: de.fosd.typechef/javabdd_repackaged
/** comment on a change to a Label */
private void comment(Label output, double diff) {
diff *= 1000; // get in %%
String str = "?";
if(diff == 0) str = "no changes";
else if(Math.abs(diff) < 10) str = "very small changes";
else if(diff > 0) {
if(diff < 30) str = "small @#¤&!";
else if( diff < 50) str = "medium @#¤&!";
else str = "major @#¤&!";
} else {
if(diff > -30) str = "small improvements";
else if(diff > -50) str = "medium improvements";
else str = "large improvements!";
}
output.setText(str);
int c = 255 - Math.min( (int)Math.abs(diff), 255);
output.setBackground( new Color( c ,255,255) );
}
代码示例来源:origin: stackoverflow.com
// Steps between fading from one colour to another.
private static final int FadeSteps = 25;
private void fade(Label panel, Color colour) throws InterruptedException {
final Color oldColour = panel.getBackground();
final int dRed = colour.getRed() - oldColour.getRed();
final int dGreen = colour.getGreen() - oldColour.getGreen();
final int dBlue = colour.getBlue() - oldColour.getBlue();
// No point if no difference.
if (dRed != 0 || dGreen != 0 || dBlue != 0) {
// Do it in n steps.
for (int i = 0; i <= FadeSteps; i++) {
final Color c = new Color(
oldColour.getRed() + ((dRed * i) / FadeSteps),
oldColour.getGreen() + ((dGreen * i) / FadeSteps),
oldColour.getBlue() + ((dBlue * i) / FadeSteps));
panel.setBackground(c);
Thread.sleep(10);
}
}
}
代码示例来源:origin: sc.fiji/3D_Viewer
@Override
public void colorChanged(final Color3f color) {
background.setColor(color);
status.setBackground(color.get());
((ImageCanvas3D) univ.getCanvas()).render();
}
代码示例来源: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: 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: stackoverflow.com
public static void showWarningPopup( Node owner, String message, double screenX, double screenY )
{
// create error image
ImageView image = new ImageView( "/resources/error-14.png" );
image.getStyleClass().add( "image-view" );
// create content
Label label = new Label( message, image );
label.setBackground(
new Background(
new BackgroundFill(
Color.ORANGE,
new CornerRadii( 10 ),
new Insets( -10 )
)
)
);
// create and show the popup
Popup popup = new Popup();
popup.setHideOnEscape( true );
popup.setAutoHide( true );
popup.setAutoFix( true );
popup.getContent().add( label );
popup.show( owner, screenX, screenY );
}
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the LifespanNameLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getLifespanNameLabel() {
if (ivjLifespanNameLabel == null) {
try {
ivjLifespanNameLabel = new java.awt.Label();
ivjLifespanNameLabel.setName("LifespanNameLabel");
ivjLifespanNameLabel.setLocation(new java.awt.Point(1, 14));
ivjLifespanNameLabel.setText(" Lifespan");
ivjLifespanNameLabel.setBackground(java.awt.SystemColor.control);
ivjLifespanNameLabel.setFont(new java.awt.Font("dialog", 2, 10));
ivjLifespanNameLabel.setBounds(new java.awt.Rectangle(1, 14, 100, 12));
ivjLifespanNameLabel.setBounds(1, 14, 100, 12);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjLifespanNameLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the RequestProcessingValueLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getRequestProcessingValueLabel() {
if (ivjRequestProcessingValueLabel == null) {
try {
ivjRequestProcessingValueLabel = new java.awt.Label();
ivjRequestProcessingValueLabel.setName("RequestProcessingValueLabel");
ivjRequestProcessingValueLabel.setLocation(new java.awt.Point(102, 66));
ivjRequestProcessingValueLabel.setText(" USE_ACTIVE_OBJECT_MAP_ONLY");
ivjRequestProcessingValueLabel.setBackground(java.awt.SystemColor.control);
ivjRequestProcessingValueLabel.setFont(new java.awt.Font("dialog", 0, 10));
ivjRequestProcessingValueLabel.setBounds(new java.awt.Rectangle(102, 66, 179, 12));
ivjRequestProcessingValueLabel.setBounds(102, 66, 179, 12);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjRequestProcessingValueLabel;
}
Label _getServantRetentionLabel() {
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the ThreadNameLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getThreadNameLabel() {
if (ivjThreadNameLabel == null) {
try {
ivjThreadNameLabel = new java.awt.Label();
ivjThreadNameLabel.setName("ThreadNameLabel");
ivjThreadNameLabel.setLocation(new java.awt.Point(1, 1));
ivjThreadNameLabel.setText(" Thread");
ivjThreadNameLabel.setBackground(java.awt.SystemColor.control);
ivjThreadNameLabel.setFont(new java.awt.Font("dialog", 2, 10));
ivjThreadNameLabel.setBounds(new java.awt.Rectangle(1, 1, 100, 12));
ivjThreadNameLabel.setBounds(1, 1, 100, 12);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjThreadNameLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the ServantRetentionNameLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getServantRetentionNameLabel() {
if (ivjServantRetentionNameLabel == null) {
try {
ivjServantRetentionNameLabel = new java.awt.Label();
ivjServantRetentionNameLabel.setName("ServantRetentionNameLabel");
ivjServantRetentionNameLabel.setLocation(new java.awt.Point(1, 53));
ivjServantRetentionNameLabel.setText(" Servant Retention");
ivjServantRetentionNameLabel.setBackground(java.awt.SystemColor.control);
ivjServantRetentionNameLabel.setFont(new java.awt.Font("dialog", 2, 10));
ivjServantRetentionNameLabel.setBounds(new java.awt.Rectangle(1, 53, 100, 12));
ivjServantRetentionNameLabel.setBounds(1, 53, 100, 12);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
}
return ivjServantRetentionNameLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label2 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getMinLabel() {
if (ivjMinLabel == null) {
try {
ivjMinLabel = new java.awt.Label();
ivjMinLabel.setName("MinLabel");
ivjMinLabel.setText("");
ivjMinLabel.setBackground(java.awt.SystemColor.control);
ivjMinLabel.setFont(new java.awt.Font("dialog", 0, 10));
ivjMinLabel.setBounds(23, 104, 25, 10);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjMinLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label22 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getAvgLabel() {
if (ivjAvgLabel == null) {
try {
ivjAvgLabel = new java.awt.Label();
ivjAvgLabel.setName("AvgLabel");
ivjAvgLabel.setText("");
ivjAvgLabel.setBackground(java.awt.SystemColor.control);
ivjAvgLabel.setFont(new java.awt.Font("dialog", 0, 10));
ivjAvgLabel.setBounds(23, 54, 25, 10);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjAvgLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label21 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getMaxLabel() {
if (ivjMaxLabel == null) {
try {
ivjMaxLabel = new java.awt.Label();
ivjMaxLabel.setName("MaxLabel");
ivjMaxLabel.setText("");
ivjMaxLabel.setBackground(java.awt.SystemColor.control);
ivjMaxLabel.setFont(new java.awt.Font("dialog", 0, 10));
ivjMaxLabel.setBounds(23, 7, 25, 10);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjMaxLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the MessageLabel property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getMessageLabel() {
if (ivjMessageLabel == null) {
try {
ivjMessageLabel = new java.awt.Label();
ivjMessageLabel.setName("MessageLabel");
ivjMessageLabel.setAlignment(java.awt.Label.CENTER);
ivjMessageLabel.setText("Message");
ivjMessageLabel.setBackground(java.awt.SystemColor.control);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjMessageLabel;
}
/**
代码示例来源: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 Label1 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getCurLabel() {
if (ivjCurLabel == null) {
try {
ivjCurLabel = new java.awt.Label();
ivjCurLabel.setName("CurLabel");
ivjCurLabel.setText("");
ivjCurLabel.setBackground(java.awt.SystemColor.control);
ivjCurLabel.setFont(new java.awt.Font("dialog", 0, 10));
ivjCurLabel.setAlignment(1);
ivjCurLabel.setBounds(0, 115, 25, 12);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjCurLabel;
}
/**
代码示例来源:origin: org.jacorb/jacorb
/**
* Return the Label1 property value.
* @return java.awt.Label
*/
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private java.awt.Label getHeaderLabel1() {
if (ivjHeaderLabel1 == null) {
try {
ivjHeaderLabel1 = new java.awt.Label();
ivjHeaderLabel1.setName("HeaderLabel1");
ivjHeaderLabel1.setAlignment(java.awt.Label.LEFT);
ivjHeaderLabel1.setFont(new java.awt.Font("dialog", 2, 10));
ivjHeaderLabel1.setText("Label1");
ivjHeaderLabel1.setBackground(java.awt.SystemColor.control);
ivjHeaderLabel1.setBounds(10, 0, 180, 20);
// user code begin {1}
// user code end
} catch (java.lang.Throwable ivjExc) {
// user code begin {2}
// user code end
handleException(ivjExc);
}
};
return ivjHeaderLabel1;
}
/**
代码示例来源:origin: movsim/movsim
protected void show(Point point, String info) {
final Label label = new Label(info, Label.LEFT);
label.setBackground(new Color(200, 220, 240));
removeAll();
add(label);
pack();
final Point screenLocation = owner.getLocationOnScreen();
setLocation(point.x + screenLocation.x + 15, point.y + screenLocation.y + 90);
currentPopupId = MyRandom.nextInt();
setVisible(true);
final PopupTimer popupTimer = new PopupTimer();
popupTimer.start(currentPopupId);
}
}
代码示例来源:origin: de.fosd.typechef/javabdd_repackaged
private void run_one(int number) {
BenchmarkSet bs = profiler.getBenchmarkSets() [number];
bRun.setEnabled(false); // dont touch that button while im working
Options.profile_cache = chProfileCache.getState();
Options.verbose = chVerbose.getState();
// show that something is going to happen...
JDDConsole.out.println("\n\n\n\n");
runInfo.setText("Running " + bs + ", please stand by...");
runInfo.setBackground( Color.white );
// do the magic
profiler.run(bs);
profiler.setDesc( desc.getText() ); // we want to show the new text!
// profiler.dump();
runInfo.setText("");
bRun.setEnabled(true); // im done
bSave.setEnabled(true); // and _now_ we can save...
// show the graphs:
dump_one(number);
}
代码示例来源:origin: movsim/movsim
protected void show(Point point, Vehicle vehicle) {
String exitString;
if (vehicle.exitRoadSegmentId() == Vehicle.ROAD_SEGMENT_ID_NOT_SET) {
exitString = this.trafficCanvas.popupStringExitEndRoad;
} else {
exitString = this.trafficCanvas.roadNetwork.findById(vehicle.exitRoadSegmentId()).userId();
}
final PhysicalQuantities vehiclePhysical = vehicle.physicalQuantities();
final String string =
String.format(this.trafficCanvas.popupString, vehicle.getId(), vehicle.getLabel(), vehicle.type(),
vehicle.lane(), vehiclePhysical.getFrontPosition(), vehiclePhysical.getSpeed() * Units.MS_TO_KMH,
vehiclePhysical.getAcc(), vehicle.totalTravelDistance(), exitString);
final Label label = new Label(string, Label.LEFT);
label.setBackground(new Color(200, 220, 240));
removeAll();
add(label);
pack();
final Point screenLocation = owner.getLocationOnScreen();
setLocation(point.x + screenLocation.x + 15, point.y + screenLocation.y + 90);
currentPopupId = vehicle.getId();
setVisible(true);
final PopupTimer popupTimer = new PopupTimer();
popupTimer.start(currentPopupId);
}
内容来源于网络,如有侵权,请联系作者删除!