JAVA 时间轴

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JAVA 时间轴相关的知识,希望对你有一定的参考价值。

用JAVA 在一个panel 用线程制作一个时间轴 (随时间变化 一条时间轴从空话到满 就像进度条一样)
那位高手帮忙 编写下 不甚感激~!!!!

就50分了~都给了

参考技术A import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.border.LineBorder;

public class TimeBar
public static void main(String[] args)
final JProgressBar bar = new JProgressBar();
bar.setBackground(Color.BLUE);
bar.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
bar.setBounds(6, 10, 0, 10);

JPanel panel = new JPanel();
panel.setLayout(null);
panel.setBounds(0, 0, 800, 50);

JFrame frame = new JFrame("Time Bar Test.");
frame.getContentPane().setLayout(null);
frame.setLocationRelativeTo(null);
frame.setSize(800, 50);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

panel.add(bar);
frame.getContentPane().add(panel);
frame.setVisible(true);

Thread t = new Thread()
public void run()
Dimension oldSize = bar.getSize();
int time = 10; // 时间间隔
while (oldSize.width < 770)
oldSize = bar.getSize();
bar.setSize(oldSize.width + 1, oldSize.height);
bar.repaint();
try
sleep(time);
catch (InterruptedException e)
System.out.println("@@@ InterruptedException");
e.printStackTrace();


System.out.println("At Last, JProgressBar's Width Is: " + bar.getSize().width);

;
t.start();

参考技术B http://java.sun.com/docs/books/tutorial/uiswing/examples/components/ProgressMonitorDemoProject/src/components/ProgressMonitorDemo.java

http://java.sun.com/docs/books/tutorial/uiswing/examples/components/ProgressBarDemo2Project/src/components/ProgressBarDemo2.java

http://java.sun.com/docs/books/tutorial/uiswing/examples/components/ProgressMonitorDemoProject/src/components/ProgressMonitorDemo.java

3个都是。。
参考技术C 分没用 RMB结算 参考技术D QQ发我 我告诉你怎么做本回答被提问者采纳

求问,有关JAVA如何实现时间轴的问题

参考技术A 你可以试试使用拉链表的方式来做DW.你需要一个时间维度表来关联你在校时间中的开始日期和结束日期~
这样你的数量业务数据和每一天的时间的关系就出来了。
不知道这样说是否清楚。本回答被提问者和网友采纳

以上是关于JAVA 时间轴的主要内容,如果未能解决你的问题,请参考以下文章

Java实现时间轴

垂直轴中间的 Java JLabel 文本

安卓笔记时间轴在哪

ARcore:如何围绕 Y 轴旋转对象?

时光轴 时间轴 效果

JFreeChart:当时间轴减少时如何缩放 Y 轴?