1.java里边形界面编程
2.在 Golang 中实现枚举
3.求java程序!源码大致设置是源码 有个边框 有箭头在里面 箭头不能越过边框 但它可以 上下
4.JAVAèè纸ç
5.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META con
java里边形界面编程
修改成这样:
import java.awt.*;
import javax.swing.*;
public class test2 extends JFrame
{
public static void main(String[] args)
{
test2 a = new test2();
}
public test2()
{
JButton a1 = new JButton("东");
JButton a2 = new JButton("西");
JButton a3 = new JButton("南");
JButton a4 = new JButton("北");
JButton a5 = new JButton("中");
this.add(a1, BorderLayout.EAST);
this.add(a2, BorderLayout.WEST);
this.add(a3, BorderLayout.SOUTH);
this.add(a4, BorderLayout.NORTH);
this.add(a5, BorderLayout.CENTER);
this.setTitle("边界布局BorderLayout");
this.setSize(, );
this.setLocation(, );
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setVisible(true);
}
}
在 Golang 中实现枚举
在 Golang 中实现枚举,枚举可以将相关的源码常量归为一种类型,简化代码逻辑。源码售后工单系统源码Golang 不直接支持枚举,源码但通过使用 `iota` 和 `const` 关键字,源码可以实现类似功能。源码接下来,源码我将展示如何使用 `iota` 实现枚举,源码并通过示例说明其用途。源码
首先,源码源码去广告了解 `iota` 关键字:`iota` 是源码一个标识符,可以简化使用自动递增数字的源码常量定义。每当在源代码中遇到 `const` 一词,源码`iota` 的源码值会重置为 0,并在每个 `const` 规范后递增。源码担保交易使用 `iota` 可以避免在每个常量前写连续的 `iota`,简化代码。
例如,要实现一个工作日枚举,可以这样定义:
go
package main
import "fmt"
// 定义工作日枚举类型
type Weekday int
const (
Monday Weekday = iota // 开始计数
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday
)
func main() {
fmt.Println(Monday) // 输出: 0
fmt.Println(Tuesday) // 输出: 1
fmt.Println(Friday) // 输出: 4
fmt.Println(Saturday) // 输出: 5
}
同样,公司管理源码可以为方向创建一个枚举:
go
package main
import "fmt"
// 定义方向枚举类型
type Direction int
const (
North Direction = iota // 开始计数
South
East
West
)
func main() {
fmt.Println(North) // 输出: 0
fmt.Println(South) // 输出: 1
fmt.Println(East) // 输出: 2
}
使用枚举类型代替硬编码的常量,可以提高代码可读性,减少逻辑错误。在 Golang 中,通过 `iota` 实现的主力资金源码枚举功能同样实现了这一目标,同时也简化了常量的管理与维护。
总之,尽管 Golang 不直接支持枚举,但通过巧妙地使用 `iota` 和 `const` 关键字,我们可以实现类似功能,为代码逻辑增加清晰度,简化常量管理。这不仅提高了代码的可读性和可维护性,也为解决实际问题提供了有力的工具。
求java程序!大致设置是 有个边框 有箭头在里面 箭头不能越过边框 但它可以 上下
IconBorder mb = new IconBorder(IconFactory.getIcon("edit/x/search.png"), SwingConstants.EAST, 5);
LineBorder lb = new LineBorder(TooneUIManager.C_SP);
CompoundBorder cb = new CompoundBorder(lb, mb);
IconBorder来自于org.jdesktop.swingx.border.IconBorder,只提供了左右的实现,你可以参照其源码实现上、下以及其他方位。
JAVAèè纸ç
æ们åä½ä¸ï¼åäºä¸ªæå çç游æï¼ä¸è¿ä¸æ¯èèçï¼æ²¡ææ·»å åºçè§åç®æ³çãåç»ä½ ï¼ä½ èªå·±ççãã纸çè¦èªå·±ä¸ï¼æååæ¹æ0--çæ°åï¼èé¢ååæ¹ærear,横åèé¢æ¹ærearheng.jpg
package com;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class puke implements MouseListener,ActionListener{
public JFrame frame=new JFrame("æå çåç");
public JButton button=new JButton("Start");
public JPanel pbutton=new JPanel();
public JPanel north=new JPanel();
public JPanel west=new JPanel();
public JPanel south=new JPanel();
public JPanel east=new JPanel();
public JPanel middle=new JPanel();
public Container container=frame.getContentPane();
public static JLabel[] l=new JLabel[];
public static JLabel[] ll =new JLabel[];
@SuppressWarnings("unchecked")
public static Set set=new HashSet();
public static JLabel[] l1=new JLabel[];
public static JLabel[] l2 =new JLabel[];
public static JLabel[] l3 =new JLabel[];
public static JLabel[] l4 =new JLabel[];
public static JLabel[] ll1 =new JLabel[];
public static JLabel[] ll2 =new JLabel[];
public static JLabel[] ll3 =new JLabel[];
public static JLabel[] ll4=new JLabel[];
boolean gstar=false;
int nn=ll.length;
int n=l.length;
int s=0;
int x=0,y=0;
@SuppressWarnings("unchecked")
public puke(){
frame.setBounds(0, 0, , );
container.setLayout(null);
north.setLayout(null);
west.setLayout(null);
south.setLayout(null);
east.setLayout(null);
north.setBounds(, 0, , );
north.setBackground(Color.GREEN);
west.setBounds(0,,,);
west.setBackground(Color.RED);
south.setBounds(,,,);
south.setBackground(Color.PINK);
east.setBounds(, , , );
east.setBackground(Color.BLUE);
pbutton.setBounds(, ,, );
middle.setBounds(, , , );
middle.setBackground(Color.YELLOW);
for(int i=0;i<l.length;i++){
l[i]=new JLabel(new ImageIcon("src/com/rear.jpg"));
l[i].setBounds(+x,,,);
container.add(l[i]);
x+=5;
}
for(int i=0;i<ll.length;i++){
ll[i]=new JLabel(new ImageIcon("src/com/"+i+".jpg"));
set.add(ll[i]);
}
button.addActionListener(this);
pbutton.add(button);
container.add(north);
container.add(west);
container.add(south);
container.add(east);
container.add(pbutton);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
compare();
}
@SuppressWarnings({ "unchecked", "unchecked" })
public void play()//ååæ£é¢å¼ ç
{
Iterator<JLabel> it = set.iterator();
while(it.hasNext()){
for(int i=0;i<;i++){
if(nn%4==0){
ll1[i]=(JLabel) it.next();
nn--;}
if(nn%4==3){
ll2[i]=(JLabel) it.next();
nn--;}
if(nn%4==2){
ll3[i]=(JLabel) it.next();
nn--;}
if(nn%4==1){
ll4[i]=(JLabel) it.next();
nn--;}
}
}
}
public void move()//å®æåçï¼æ¯ä½ç©å®¶å¾å°å¼ ç
{
play();
int i;
while(n!=0){
for(i=0;i<;i++){
if(s<){
if(n%4==0){
l1[i]=l[s];
l1[i].setBounds(-+x, , , );
north.add(l1[i]);
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
x+=;
s++;
n--;
continue;
}
if(n%4==3){
l[s].setIcon(new ImageIcon("src/com/rearheng.jpg"));
l2[i]=l[s];
l2[i].setBounds(, +y,,);
west.add(l2[i]);
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
y+=;
s++;
n--;
continue;
}
if(n%4==2){
l[s].setIcon(null);
l3[i]=ll3[i];
l3[i].setBounds(-x, , , );
l3[i].addMouseListener(this);
south.add(l3[i]);
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
x+=;
s++;
n--;
continue;
}
if(n%4==1){
l[s].setIcon(new ImageIcon("src/com/rearheng.jpg"));
l4[i]=l[s];
l4[i].setBounds(,-y,,);
east.add(l4[i]);
try {
Thread.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
y+=;
s++;
n--;
continue;
}
}
}
}
button.setVisible(false);
pbutton.remove(button);
container.remove(pbutton);
container.add(middle);
frame.repaint();
}
public void mouseClicked(MouseEvent e)//ç¹å»é¼ æ åºç
{
for(int i=0;i<;i++){
if(gstar){
middle.remove(l3[i]);
middle.remove(ll1[i]);
middle.remove(ll2[i]);
middle.remove(ll4[i]);
if(e.getSource()==l3[i]){
north.remove(l1[i]);
west.remove(l2[i]);
east.remove(l4[i]);
south.remove(l3[i]);
middle.add(l3[i]);
middle.add(ll1[i]);
middle.add(ll2[i]);
middle.add(ll4[i]);
l3[i].setBounds(l3[i].getBounds().x, , , );
ll1[i].setBounds(, , , );
ll2[i].setBounds(, , , );
ll3[i].setBounds(, , , );
ll4[i].setBounds(, , , );
frame.repaint();
}
}
}
}
public void mouseEntered(MouseEvent e) //éæ©è¦åºçç
{
for(int i=0;i<;i++){
if(gstar){
if(e.getSource()==l3[i]){
l3[i].setBounds(l3[i].getBounds().x, l3[i].getBounds().y-, , );
}
}
}
}
public void mouseExited(MouseEvent e) {
for(int i=0;i<;i++){
if(gstar){
if(e.getSource()==l3[i]){
l3[i].setBounds(l3[i].getBounds().x,l3[i].getBounds().y+, , );
}}}
}
public puke getthis(){
return this;
}
public void mousePressed(MouseEvent e) {
}
public void mouseReleased(MouseEvent e) {
}
public static void main(String[]args){
new puke();
}
public class TestThread extends Thread{
private puke g=null;
public TestThread(puke g){
this.g=g;
}
public void run() {
while(true){
g.move();
try {
Thread.sleep();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
public void actionPerformed(ActionEvent e) //ç¹å»æé®äºä»¶
{
if(e.getSource()==button){
gstar=true;
TestThread t= new TestThread(this);
t.start();
}
}
@SuppressWarnings("unchecked")
public int compare(){
JLabel[] lab=new JLabel[ll.length];
String[] str=new String[ll.length];
set.toArray(lab);
for(int l=0;l<ll.length;l++){
str[l]=lab[l].getIcon().toString();
System.out.println(str[l]);
}
return n;
}
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META con
è¿ä¸ªï¼æ²¡æ³åæåºåªå¿é误ãå 为è¿ä¸ªæºç æ¯è¿åé误çæºç ã
å®é æ¾ç¤ºçå 容ï¼å°±åªæ<?xml:namespace prefix = "o" ns =
"urn:schemas-microsoft-com:office:office"
/>
è¿æ¯ä¸ªxmlæ©å±è¯è¨ï¼ä½æ¯ï¼è¿ä¸ªçä¸ææ¯ä»ä¹ãåªè½ç¥éï¼ä½ è¿æºç æ¥èªoffice设计åºæ¥çã