-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
テキストフィールドからはみ出してテキストを空白にするとクラッシュするバグがあったので、サイズを変えてからテキストを空白にセットするとかなり…
…無理やりだが空白文字にできた
- Loading branch information
1 parent
03f8bcf
commit f75ff1d
Showing
5 changed files
with
28 additions
and
6 deletions.
There are no files selected for viewing
17 changes: 13 additions & 4 deletions
17
src/main/java/com/hashibutogarasu/screenshottweet/Custom/CustomTextField.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
package com.hashibutogarasu.screenshottweet.Custom; | ||
|
||
import io.github.cottonmc.cotton.gui.widget.WTextField; | ||
import net.minecraft.text.TranslatableText; | ||
|
||
import static com.hashibutogarasu.screenshottweet.Ids.Id.MOD_ID; | ||
import static com.hashibutogarasu.screenshottweet.guis.TweetScreenGUI.root; | ||
import static com.hashibutogarasu.screenshottweet.guis.TweetScreenGUI.tweettext; | ||
|
||
public class CustomTextField extends WTextField { | ||
public void clear(){ | ||
for(int c = this.getText().length(); c>=0; c--){ | ||
this.setText(this.getText().substring(0,c)); | ||
} | ||
public void refresh() throws InterruptedException { | ||
tweettext.setSize(2000,12); | ||
Thread.sleep(100); | ||
tweettext.setText(new TranslatableText(MOD_ID + ".gui.tweettextfield").getString()); | ||
Thread.sleep(100); | ||
root.remove(tweettext); | ||
Thread.sleep(100); | ||
root.add(tweettext, 13, 2, 7, 12); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters