Java の Swing で起りました
Javaの環境は Java SE 1.8 です
OS は Windows10 64bit
状況 Swing で JFrame を 半透明にしました
発生した問題 テキストに文字を入力中 全GUIが 真白になる
現状試したこと
ググってみると何件か 同じ例が見られる
推測では Java側の ミスらしい
対策が何件か 乗っていたので実行
実行は以下
対処した事
System.setProperty("sun.awt.nopixfmt","true");
上記をソースに追加
結果
相変わらず白くなる
どうしたいか?
白くならないようにしたいです
ソースは以下
Java
1 2public class Main extends net.axwork.fuji.top.SupperClass { 3 String nows = aruRead("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root/"+"setting/item_now_position.set").replace("\n",""); 4 5 String back = String.valueOf(sizeWidth+yohaku)+",0"; 6 String set = ""; 7 private String App = ""; 8 9 10 String pack = "C:/Users/" + System.getProperty("user.name") + "/Documents/" + "net.axwork.fuji.root/root"; 11 String nowButton = pack; 12 13 private JList<String> guiLtlst; 14 15 private JTextField tv; 16 17 private JButton guiBtnback; 18 19 private JButton guiBtnetc; 20 21 private JButton guiBtnok; 22 23 JFrame jf = null; //sengen1 24 public Main() { 25 System.setProperty("sun.java2d.noddraw","true"); 26 System.setProperty("sun.awt.nopixfmt","true"); 27 JFrame.setDefaultLookAndFeelDecorated(true); 28 jf = new JFrame(); 29 jf.setBackground(new Color(0x0, true));jf.setBackground(new Color(255,255,255,99)); 30 31 32 set = "C:/Users/" + System.getProperty("user.name") + "/Documents/" + "net.axwork.fuji.root/setting/"; 33 34 App = aruRead("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root"+"/setting/item_now_position.set").replace("\n", "").replace("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root", ""); 35 36 String backm = aruRead("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root"+App+"/app_position.set").replace("\n", ""); 37 if(!backm.equals("")) { 38 //back = backm; 39 }else { 40 back = String.valueOf(sizeWidth+yohaku)+",0"; 41 } 42 43 String lookAndFeel = ""; 44 lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; 45 try { 46 UIManager.setLookAndFeel(lookAndFeel); 47 SwingUtilities.updateComponentTreeUI(this); 48 } catch (Exception ex) { 49 ex.printStackTrace(); 50 } 51 52 53 String ck = aruRead(aruRead("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root/"+"setting/item_now_position.set").replace("\n","")+"/ltvItem2.set").replace("\n",""); 54 String[] data = ck.split(","); 55 guiLtlst = new JList(data); 56 setMojiHi(guiLtlst); 57 setListViewColor(guiLtlst); 58 guiLtlst.addMouseListener(new MouseListener() { 59 60 @Override 61 public void mouseReleased(MouseEvent e) { 62 63 } 64 65 @Override 66 public void mousePressed(MouseEvent e) { 67 68 } 69 70 @Override 71 public void mouseExited(MouseEvent e) { 72 73 } 74 75 @Override 76 public void mouseEntered(MouseEvent e) { 77 78 } 79 80 @Override 81 public void mouseClicked(MouseEvent e) { 82 83 } 84 }); 85 guiLtlst.setToolTipText(""); 86 guiLtlst.addListSelectionListener(new ListSelectionListener() { 87 @Override 88 public void valueChanged(ListSelectionEvent e) { 89 //guiLtlstMeth 90 } 91 }); 92 93 JScrollPane guiScLtlst = new JScrollPane(guiLtlst); 94 guiScLtlst.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); 95 guiScLtlst.setPreferredSize(new Dimension(246, 135)); 96 guiScLtlst.setBounds(yohaku, yohaku, sizeWidth-yohaku-yohaku, frame_all_h_2-yohaku-yohaku); 97 jf.add(guiScLtlst, BorderLayout.CENTER); 98 99 100 tv = new JTextField(""); 101 setTextFieldColor(tv); 102 tv.setBounds(yohaku, frame_all_h_2+yohaku, sizeWidth-yohaku-yohaku, button_ss_h-yohaku-yohaku); 103 jf.add(tv); 104 105 106 guiBtnback = new JButton("終了"); 107 setButtonColor(guiBtnback); 108 guiBtnback.addMouseListener(new MouseListener() { 109 110 @Override 111 public void mouseReleased(MouseEvent e) { 112 113 } 114 115 @Override 116 public void mousePressed(MouseEvent e) { 117 118 } 119 120 @Override 121 public void mouseExited(MouseEvent e) { 122 guiBtnback.setVisible(false); 123 guiBtnback.setVisible(true); 124 } 125 126 @Override 127 public void mouseEntered(MouseEvent e) { 128 guiBtnback.setVisible(false); 129 guiBtnback.setVisible(true); 130 } 131 132 @Override 133 public void mouseClicked(MouseEvent e) { 134 135 } 136 }); 137 guiBtnback.setFocusPainted(false); 138 guiBtnback.setToolTipText(""); 139 guiBtnback.setMnemonic(97); 140 guiBtnback.addActionListener(new ActionListener() { 141 @Override 142 public void actionPerformed(ActionEvent e) { 143 //guiBtnbackMeth 144 aruWrite(set + "item.txt", App); 145 //aruWrite("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root"+App+"/app_position.set",getX()+","+getY()); 146 jf.setVisible(false); 147 } 148 }); 149 //imgButton 150 guiBtnback.setBounds(yohaku, button_ss_h+button_d9_h_2+button_d9_h_2+button_d9_h_2+yohaku, frame_1p3_w-yohaku-yohaku, button_ss_h-yohaku-yohaku); 151 jf.add(guiBtnback); 152 153 guiBtnetc = new JButton("その他"); 154 setButtonColor(guiBtnetc); 155 guiBtnetc.addMouseListener(new MouseListener() { 156 157 @Override 158 public void mouseReleased(MouseEvent e) { 159 160 } 161 162 @Override 163 public void mousePressed(MouseEvent e) { 164 165 } 166 167 @Override 168 public void mouseExited(MouseEvent e) { 169 guiBtnetc.setVisible(false); 170 guiBtnetc.setVisible(true); 171 } 172 173 @Override 174 public void mouseEntered(MouseEvent e) { 175 guiBtnetc.setVisible(false); 176 guiBtnetc.setVisible(true); 177 } 178 179 @Override 180 public void mouseClicked(MouseEvent e) { 181 182 } 183 }); 184 guiBtnetc.setFocusPainted(false); 185 guiBtnetc.setToolTipText(""); 186 guiBtnetc.setMnemonic(98); 187 guiBtnetc.addActionListener(new ActionListener() { 188 @Override 189 public void actionPerformed(ActionEvent e) { 190 //guiBtnetcMeth 191 aruWrite(set + "item.txt", App); 192 } 193 }); 194 //imgButton 195 guiBtnetc.setBounds(frame_1p3_w+yohaku, button_ss_h+button_d9_h_2+button_d9_h_2+button_d9_h_2+yohaku, frame_1p3_w-yohaku-yohaku, button_ss_h-yohaku-yohaku); 196 jf.add(guiBtnetc); 197 198 guiBtnok = new JButton("開く"); 199 setButtonColor(guiBtnok); 200 guiBtnok.addMouseListener(new MouseListener() { 201 202 @Override 203 public void mouseReleased(MouseEvent e) { 204 205 } 206 207 @Override 208 public void mousePressed(MouseEvent e) { 209 210 } 211 212 @Override 213 public void mouseExited(MouseEvent e) { 214 guiBtnok.setVisible(false); 215 guiBtnok.setVisible(true); 216 } 217 218 @Override 219 public void mouseEntered(MouseEvent e) { 220 guiBtnok.setVisible(false); 221 guiBtnok.setVisible(true); 222 } 223 224 @Override 225 public void mouseClicked(MouseEvent e) { 226 227 } 228 }); 229 guiBtnok.setFocusPainted(false); 230 guiBtnok.setToolTipText(""); 231 guiBtnok.setMnemonic(99); 232 guiBtnok.addActionListener(new ActionListener() { 233 @Override 234 public void actionPerformed(ActionEvent e) { 235 //guiBtnokMeth 236 aruWrite(set + "item.txt", App); 237 238 } 239 }); 240 //imgButton 241 guiBtnok.setBounds(frame_1p3_w+frame_1p3_w+yohaku, button_ss_h+button_d9_h_2+button_d9_h_2+button_d9_h_2+yohaku, frame_1p3_w-yohaku-yohaku, button_ss_h-yohaku-yohaku); 242 jf.add(guiBtnok); 243 244 //tukuri1 245 246 ck = aruRead("C:/Users/"+System.getProperty("user.name")+"/Documents/"+"net.axwork.fuji.root/setting/item_now_position.set").replace("\n",""); 247 248 if(!ck.equals("")){ 249 aruSetSpn(guiLtlst,"ltvItem2.set"); 250 }else{ 251 aruSetSpn2(guiLtlst,"ltvItem2.set"); 252 } 253 254 setMojiHi(tv); 255 256 setMojiHi(guiBtnback); 257 258 setMojiHi(guiBtnetc); 259 260 setMojiHi(guiBtnok); 261 262 jf.getContentPane().setLayout(null); 263 jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 264 jf.setResizable(false); 265 jf.setTitle(""); 266 String[] backs = back.split(","); 267 jf.setBounds(Integer.parseInt(backs[0]), Integer.parseInt(backs[1]),(size_width+yohaku), (size_hight+yohaku)); 268 jf.setVisible(true); 269 } 270 271} 272
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。