可能重复:
Swing:如何将组件高度设置为容器的高度?
我如何划分JPanel像下面显示的图片有2个面板panel1和panel2 panel1应占70%和panel2 30%或panel1应该大于panel2 ...我试过Gridlayout,边框布局,但它不工作.任何帮助不胜感激.
public class TestApplication extends JApplet {
private static final long serialVersionUID = 1L;
JPanel p1,p2;
public void init(){
setLayout(new GridLayout(3,1));
p1=new JPanel();
p2=new JPanel();
p1.setBackground(Color.RED);
p2.setBackground(Color.GREEN);
add(p1);
add(p2);
}
}
Run Code Online (Sandbox Code Playgroud)
我已经浏览了这个网站改变外观和感觉,JSlider
但除了Slider.altTrackColor
没有其他工作.我想做一些像pic1所示的事情,任何建议都会有很大的帮助.我正在研究JDK 1.6.
UIDefaults defaults = UIManager.getDefaults();
defaults.put("Slider.altTrackColor", Color.red);
defaults.put("Slider.thumb", Color.red);
Run Code Online (Sandbox Code Playgroud)
我也试过这个:
WindowUtilities.setNativeLookAndFeel();
// WindowUtilities.setNimbuzzLookAndFeel();
// WindowUtilities.setJavaLookAndFeel();
Run Code Online (Sandbox Code Playgroud)
WindowUtilities是一个类,它告诉系统使用本机外观,就像在以前的版本中一样.Metal(Java)LAF是默认值.
public static void setNativeLookAndFeel() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
System.out.println("Error setting native LAF: " + e);
}
Run Code Online (Sandbox Code Playgroud)
这个表" Trade
"带有列" call
",Call包含values(C,P)
从CSV加载时我想更新来自java程序的Trade if call='C' then call='CE'
和
if call='P' then call='PE'
我发现这可以使用2个查询完成.就像这样
update Trade set call='CE' where call='C';
update Trade set call='PE' where call='P';
Run Code Online (Sandbox Code Playgroud)
无论如何这可以在单个查询中完成吗?