本文整理汇总了Java中javax.swing.JWindow.setOpacity方法的典型用法代码示例。如果您正苦于以下问题:Java JWindow.setOpacity方法的具体用法?Java JWindow.setOpacity怎么用?Java JWindow.setOpacity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JWindow
的用法示例。
在下文中一共展示了JWindow.setOpacity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AutoSuggestor
import javax.swing.JWindow; //导入方法依赖的package包/类
/**
* Istanzia il suggeritore su un componente testo
*
* @param textComp finestra di testo su cui istanziare il suggeritore
* @param mainWindow finestra principale
* @param words lista di parole
* @param popUpBackground colore dello sfondo
* @param textColor colore del testo
* @param suggestionFocusedColor colore del suggeritore
* @param opacity indice di opacità
*/
public AutoSuggestor(JTextComponent textComp, Window mainWindow, List<String> words, Color popUpBackground, Color textColor, Color suggestionFocusedColor, float opacity) {
this.textComp = textComp;
this.suggestionsTextColor = textColor;
this.container = mainWindow;
this.suggestionFocusedColor = suggestionFocusedColor;
this.textComp.getDocument().addDocumentListener(documentListener);
setDictionary(words);
typedWord = "";
currentIndexOfSpace = 0;
tW = 0;
tH = 0;
autoSuggestionPopUpWindow = new JWindow(mainWindow);
autoSuggestionPopUpWindow.setOpacity(opacity);
suggestionsPanel = new JPanel();
suggestionsPanel.setLayout(new GridLayout(0, 1));
suggestionsPanel.setBackground(popUpBackground);
suggestionsPanel.setBorder(new LineBorder(Color.black));
addKeyBindingToRequestFocusInPopUpWindow();
}
示例2: start
import javax.swing.JWindow; //导入方法依赖的package包/类
/** Start the bot. */
public void start() {
Toolkit tk = Toolkit.getDefaultToolkit();
int xSize = ((int) tk.getScreenSize().getWidth());
int ySize = ((int) tk.getScreenSize().getHeight());
window = new JWindow();
window.setSize(xSize, ySize);
window.setOpacity(0.0f);
window.setVisible(true);
window.setAlwaysOnTop(true);
window.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
if (clicks < _numberOfLocations) {
location[clicks] = getLocation();
window.setVisible(false);
sleep();
click();
sleep();
window.setVisible(true);
sleep();
clicks += 1;
}
if (clicks == _numberOfLocations) {
window.setVisible(false);
process();
}
}
});
}