teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

7

誤字変更

2019/07/30 04:16

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -65,7 +65,7 @@
65
65
  ###出来ないこと
66
66
  配列の固定化になります。現状なぜかNow loading…のうちの1文字しか現れないという現象に陥っています。
67
67
 
68
- ###tesutesuさんへ
68
+ ###tetutetuさんへ
69
69
  ```java
70
70
  import java.io.IOException;
71
71
 

6

コード追記

2019/07/30 04:16

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -65,6 +65,40 @@
65
65
  ###出来ないこと
66
66
  配列の固定化になります。現状なぜかNow loading…のうちの1文字しか現れないという現象に陥っています。
67
67
 
68
+ ###tesutesuさんへ
69
+ ```java
70
+ import java.io.IOException;
71
+
72
+ class Load2{
73
+ public static void main(String[] args) throws InterruptedException, IOException{
74
+ String Load[]={"N","o","w"," ","L","o","a","d","i","n","g","…"," "};
75
+ System.out.println("\n");
76
+ while(true){
77
+ for(int i=0;i<Load.length;i++){
78
+ for(int r=0;r<=i;r++){
79
+ if(r==i)System.out.print(Load[r]);
80
+ else System.out.print(" ");
81
+ }
82
+ System.out.println("\n");
83
+ for(int t=0;t<Load.length;t++){
84
+ if(t==i){
85
+ System.out.print(" ");
86
+ continue;
87
+ }
88
+ else System.out.print(Load[t]);
89
+ }
90
+ Thread.sleep(100); //削除する前に1秒待つ
91
+ new ProcessBuilder("cmd", "/c", "cls").inheritIO().start().waitFor();
92
+ System.out.print("\r");
93
+ for (int r=0; r<Load.length; r++){//文字の数だけ半角の空白に置き換える
94
+ System.out.print(" ");
95
+ }
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
101
+
68
102
  ### 補足情報(FW/ツールのバージョンなど)
69
103
 
70
- Terapadで入力、JDKによりwindowsコンソールで動かしています。
104
+ Terapadで入力、JDKによりwindows標準搭載のドプロンプトで動かしています。

5

コードの説明追加

2019/07/30 04:15

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -24,7 +24,6 @@
24
24
  String Load[]={"N","o","w"," ","L","o","a","d","i","n","g","…"," "};
25
25
  for(int i=0;i<Load.length;i++)System.out.print(Load[i]);//元の文章を一度表示した後、改行
26
26
  System.out.println("\n");
27
- String LoadingInput[]=new String[13];//
28
27
  String Tmp[]={" "," "," "," "," "," "," "," "," "," "," "," "," "};//仮入れ用
29
28
  String str_space = " ";
30
29
  while(true){

4

コードの説明追加

2019/07/30 01:13

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -22,7 +22,7 @@
22
22
  class Load2{
23
23
  public static void main(String[] args) throws InterruptedException{
24
24
  String Load[]={"N","o","w"," ","L","o","a","d","i","n","g","…"," "};
25
- for(int i=0;i<Load.length;i++)System.out.print(Load[i]);
25
+ for(int i=0;i<Load.length;i++)System.out.print(Load[i]);//元の文章を一度表示した後、改行
26
26
  System.out.println("\n");
27
27
  String LoadingInput[]=new String[13];//
28
28
  String Tmp[]={" "," "," "," "," "," "," "," "," "," "," "," "," "};//仮入れ用

3

実現したいことの簡潔化

2019/07/30 01:06

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -1,8 +1,4 @@
1
1
  ### 前提・実現したいこと
2
-
3
- Javaでモンスターハンターのローディング画面(みたいなもの)を作成したいと考えています。
4
- 完全に遊びですが、詰まってしまったので回答していただけると嬉しいです。
5
-
6
2
  後に出てくるfor文のiによって
7
3
  i=0では
8
4
  ```
@@ -19,7 +15,7 @@
19
15
  w
20
16
  No loading…
21
17
  ```
22
- みたいにやりたいです。
18
+ のような形で表示するプログラムが作りたいです。
23
19
  ### 該当のソースコード
24
20
 
25
21
  ```ここに言語名を入力

2

出来ないことの追加

2019/07/30 01:05

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -67,6 +67,9 @@
67
67
 
68
68
  \rの挙動がよくわからないです…ただ、消すときにLoadとTmp両方消す必要があるのでそこは違うのかなって思ってます。
69
69
 
70
+ ###出来ないこと
71
+ 配列の固定化になります。現状なぜかNow loading…のうちの1文字しか現れないという現象に陥っています。
72
+
70
73
  ### 補足情報(FW/ツールのバージョンなど)
71
74
 
72
75
  Terapadで入力、JDKによりwindowsコンソールで動かしています。

1

文書修正

2019/07/30 00:56

投稿

horizon
horizon

スコア21

title CHANGED
File without changes
body CHANGED
@@ -34,7 +34,7 @@
34
34
  while(true){
35
35
  for(int i=0;i<Load.length;i++){
36
36
  System.out.print(Tmp[i]);
37
- /*System.out.println("\n");*/
37
+ System.out.println("\n");
38
38
  System.out.print(Load[i]);
39
39
  Thread.sleep(100); //削除する前に1秒待つ
40
40
  String t=Load[i];//三点交換