- 博客(5)
- 收藏
- 关注
转载 javaGUI 布局管理器
一.FlowLayout Panel的默认布局管理器 从左至右逐行定位,一行排满后换行 默认对齐方式是居中 构造方法 new FlowLayout(FlowLayout.RIGHT, 20, 40); //右对齐,组件之间水平间距 20 个像素,垂直间距 40 个像素 new FlowLayout(FlowLayout.LEFT); //左对齐,水平和垂直间距为缺省值 5 new...
2019-07-18 13:36:51
209
原创 鸡蛋凤凰
心理课玩过这样一个游戏 游戏规则 总结的时候有位同学装B说最后会趋近于都是凤凰,我就很不服 写了如下代码测试 public class Egg { private int id = 0; /** * 0-鸡蛋 1-小鸡 2-大鸡 3-凤凰 */ public void pk(Egg e2) { if((int)(Math.random() * 2) == 0){ ...
2019-07-07 15:41:28
225
原创 速配分数
前两天在空间里看到这样一个东西 就好奇写了段代码计算 计算代码如下 private static int calc(int...nums) { for (int i = nums.length - 1; i > 0; i--) { for (int j = 0; j < i; j++) { nums[j] = Math.abs(nums[j] - nums[...
2019-06-09 14:22:00
3797
原创 一个文字版Java双人对抗游戏源码
Main.java import javax.swing.JLabel; import javax.swing.JOptionPane; public class Main { public static void main(String[] args) { Warrior p1 = new Warrior( JOptionPane.showInputDialog(null...
2019-05-19 14:46:51
2341
原创 Java绘制平面直角坐标系(可设定关系式)
import java.awt.*; import javax.swing.*; public class NumberAxis extends JPanel{ JFrame frame; public static void main(String[] args) { NumberAxis numberAxis = new NumberAxis(); numberAx...
2018-08-04 12:21:05
5340
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅