2009-09-01から1ヶ月間の記事一覧

XMLSocketで接続する際のポリシーファイル

http://livedocs.adobe.com/flash/9.0_jp/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001087.html Flash Player 7 以降では外部に対してXMLSocket接続する場合、ポリシーファイルをサーバー側から返してあげないといけない…

socketで相手が接続を切ったのを判断する

public void run() { while(isConnecting) { try { String inputLine; while ((inputLine = in.readLine()) != null) { out.println("return:"+System.currentTimeMillis()); } if(inputLine == null) { // 相手の接続が切れた } } catch (IOException e) { …

XMLSocket の send

http://livedocs.adobe.com/flash/9.0_jp/ActionScriptLangRefV3/flash/net/XMLSocket.html socket.send("aiueo"+count+"\n"); socket.send("aiueo"+count+"\r");最後に "\n" か "\r" 入れないとjavaで作ったサーバー側がメッセージを受け取ってくれない...?…

ラベルに背景色をつける。

label = new JLabel(); label.setText("Label"); label.setFont(font); label.setOpaque(true);// 不透明の設定 label.setHorizontalAlignment(JLabel.CENTER);// 文字を中央に揃える label.setBackground(new Color(0x000000));

浮彫の無いボタン

button = new JButton(); Font font = new Font("Verdana", Font.PLAIN, 12); button.setFocusPainted(false); button.setFont(font); button.setText("Button"); button.setBackground(new Color(0xeeeeee));

JTextArea, TextArea

TextAreaは文字が横幅を超えた場合に自動でスクロールをつけてくれるが JTextAreaはそれがない public class MainFrame extends JFrame{ public MainFrame() { this.setTitle(WINDOW_TITLE); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.set…