import java.awt.event.ActionEvent
import java.awt.event.ActionListener
import javax.swing.JFrame
public class Demo {
public static void main(String[] args) {
Demo demo = new Demo()
demo.run()
}
public void run() {
JFrame frame = new JFrame("title1")
frame.setLayout(null)
frame.setBounds(10, 10, 500, 300)
Button button = new Button("click")
button.setBounds(15, 15, 200, 100)
frame.add(button)
frame.setVisible(true)
button.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JFrame frame = new JFrame("title2")
frame.setLayout(null)
frame.setBounds(20, 20, 300, 100)
frame.setVisible(true)
}
})
}
}
1、设置状态栏为透明黑色:在AppDelegate.h的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions函数里:添加:
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackOpaque
// UIStatusBarStyleBlackTranslucent不行
[self.navigationBar setBackgroundImage:[UIImage imageNamed:@"navigationBar_bk"] forBarMetrics:UIBarMetricsDefault]
[self.navigationBar setBackgroundColor:[UIColor blackColor]]// 设置导航栏背景颜色
self.navigationBar.tintColor = [UIColor colorWithRed:51.0/255.0 green:143.0/255.0 blue:210.0/255.0 alpha:0.8]// 其上默认按钮(比如返回按钮)颜色
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)