最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

在面板中添加復(fù)雜圖像,在一個(gè)自定義用戶界面中使用按鈕

在面板中添加復(fù)雜圖像,在一個(gè)自定義用戶界面中使用按鈕

在面板中添加復(fù)雜圖像,在一個(gè)自定義用戶界面中使用按鈕我怎樣才能將這樣的圖像放到slavePanelJPanel的頂部和頂部,調(diào)整JButtons看起來像圖像但是按鈕正確纏繞?(現(xiàn)在它們形成一排,四列)在此輸入圖像描述  //  // Shot Gun mover up/down/left/right, middle on is for zoom  //  public void GunMover(JPanel configPanel) throws IOException {    // Master Panel - holds everything    JPanel masterPanel = new Panel();    masterPanel.setLayout(new SpringLayout());    // Slave Panel - with image background     JPanel slavePanel = new Panel();    slavePanel.setLayout(new SpringLayout());    // Row 1    final JButton ptzLeft = new JButton("<");           masterPanel.add(ptzLeft, BorderLayout.WEST);    // Row 2    final JButton ptzRight = new JButton(">");       masterPanel.add(ptzRight, BorderLayout.CENTER);        // Row 3    final JButton ptzUp = new JButton("^");       masterPanel.add(ptzUp, BorderLayout.WEST);        // Row 4    final JButton ptzDown = new JButton("down");       masterPanel.add(ptzDown, BorderLayout.CENTER);        // How do i add slavePanel this background and add all the JButtons     // According to that image shape?    // Layout the panel.    SpringUtilities.makeCompactGrid(masterPanel,                                1, 4, //rows, cols                                6, 6, //initX, initY                                6, 6);            configPanel.setLayout(new GridLayout(0,1));    configPanel.add(masterPanel);     }跟進(jìn):優(yōu)秀的一個(gè)來自Andrew Thompson +至少我的破碎方法在此輸入圖像描述package test;import java.awt.*;import java.awt.font.FontRenderContext;import java.awt.font.TextLayout;import javax.swing.*;public class New extends JFrame {  private static final long serialVersionUID = 1L;  private ImageIcon errorIcon =          (ImageIcon) UIManager.getIcon("OptionPane.errorIcon");  private Icon infoIcon =          UIManager.getIcon("OptionPane.informationIcon");  private Icon warnIcon =          UIManager.getIcon("OptionPane.warningIcon");
查看完整描述

3 回答

?
陪伴而非守候

TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊

從這個(gè)例子開始,我開始改變MoveButton這樣:

this.setBorderPainted(false);

你可以給ControlPanel一個(gè)自定義布局管理器


查看完整回答
反對 回復(fù) 2019-05-29
?
弒天下

TA貢獻(xiàn)1818條經(jīng)驗(yàn) 獲得超8個(gè)贊

1)你必須為每5個(gè)JButton準(zhǔn)備好圖標(biāo)(事件來自ButtonModel)

  • 沒有焦點(diǎn)的基本圖標(biāo)

  • 圖標(biāo)?isRollover()

  • 圖標(biāo)?isPressed()

2)如何設(shè)置圖標(biāo)并從JButton中刪除所有“balast”

3)把這些5 JButtonsJPanel涂成圓圈(RemoteSet)


查看完整回答
反對 回復(fù) 2019-05-29
  • 3 回答
  • 0 關(guān)注
  • 911 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號