2011-01-31 12 views
0

TextArea의 배경을 불투명하게하고 싶습니다. Netbeans에서 스윙 GUI 양식을 사용하고 있습니다.TextArea의 배경을 불투명하게 만듭니다.

이미지의 앞쪽에있는 지침을 겹치기를 원하지만, 이미지가 이미지의 앞쪽에있는 경우 텍스트를 볼 수 없다는 문제가 있습니다. 난 정말 모호하지 않은 배경이 여기에 문제가 있는지 모르겠다. (필자는 그림이 위치한 JLabel을 가지고 계층화 된 창을 사용하고 지침을 배치 한 TextArea를 겹쳐서 사용했다.)

문제의 원인을 파악하는 데 도움을 줄 수 있습니까?

import java.awt.Color; 
import javax.swing.ImageIcon; 
import javax.swing.JFrame; 

public class About extends javax.swing.JDialog { 

public About(JFrame owner) { 
    super(owner, true); 
    initComponents(); 
    setSize(500, 500); 
    setLocation(300, 120); 
    getContentPane().setBackground(Color.getHSBColor(204, 204, 255)); 
    jLabel1.setIcon(new ImageIcon("HangmanStartlight.jpg")); 

} 

@SuppressWarnings("unchecked") 
// <editor-fold defaultstate="collapsed" desc="Generated Code"> 
private void initComponents() { 

    jTabbedPane1 = new javax.swing.JTabbedPane(); 
    jLayeredPane1 = new javax.swing.JLayeredPane(); 
    jLabel1 = new javax.swing.JLabel(); 
    jScrollPane1 = new javax.swing.JScrollPane(); 
    jTextArea1 = new javax.swing.JTextArea(); 

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 

    jLabel1.setText("jLabel1"); 
    jLabel1.setBounds(0, 0, 420, 290); 
    jLayeredPane1.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER); 

    jTextArea1.setColumns(20); 
    jTextArea1.setFont(new java.awt.Font("Microsoft Sans Serif", 1, 14)); // NOI18N 
    jTextArea1.setForeground(new java.awt.Color(51, 0, 51)); 
    jTextArea1.setRows(5); 
    jTextArea1.setText("Hangman\n\nGuess the \"HIDDEN PHRASE\" to proceed to the next\nlevel. Hangman is filled with several words, \npresented in random order each time you play.\n\nhOw To pLay!!!\n\nYou can select letters by clicking on the letter buttons\nshown at the window.\n\nBe very careful! 'coz you are only allowed 10 wrong\nguesses per puzzle.\n\nYou will at the corner Top-Left of the window your \n\"Name\", your \"Score\", your \"Level\", your \"Lives Left\"\nand also the \"Life Line\" which you can use as a Hint.\n\nEnjoy Playing and Have Fun :)"); 
    jTextArea1.setWrapStyleWord(true); 
    jScrollPane1.setViewportView(jTextArea1); 

    jScrollPane1.setBounds(0, 0, 420, 280); 
    jLayeredPane1.add(jScrollPane1, javax.swing.JLayeredPane.DEFAULT_LAYER); 

    jTabbedPane1.addTab("tab1", jLayeredPane1); 

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 
    getContentPane().setLayout(layout); 
    layout.setHorizontalGroup(
     layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
     .addGroup(layout.createSequentialGroup() 
      .addGap(26, 26, 26) 
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 427, javax.swing.GroupLayout.PREFERRED_SIZE) 
      .addContainerGap(39, Short.MAX_VALUE)) 
    ); 
    layout.setVerticalGroup(
     layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
     .addGroup(layout.createSequentialGroup() 
      .addGap(21, 21, 21) 
      .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 313, javax.swing.GroupLayout.PREFERRED_SIZE) 
      .addContainerGap(128, Short.MAX_VALUE)) 
    ); 

    pack(); 
}// </editor-fold> 
// Variables declaration - do not modify 
private javax.swing.JLabel jLabel1; 
private javax.swing.JLayeredPane jLayeredPane1; 
private javax.swing.JScrollPane jScrollPane1; 
private javax.swing.JTabbedPane jTabbedPane1; 
private javax.swing.JTextArea jTextArea1; 
// End of variables declaration 
} 

추신 : 여기 enter image description here

코드입니다 스윙 빌더/스윙 GUI 양식을 사용 중입니다 ...

+1

일부 코드를 공유하고 지금까지 시도한 것을 보여 주면 도움이 될 것입니다. 또한, 귀하의 질문에 그림에서 ** 텍스트의 배경은 ** 불투명합니다. 투명하게되기를 원하십니까? –

답변

-1

화면에 수동으로 텍스트를 그리는 구성 요소를 직접 작성하십시오. 그것이 게임이 Java로 만들어지는 방법입니다. Swing으로하지 마십시오.

관련 문제