当前位置: 首页>>代码示例>>Java>>正文


Java Channel类代码示例

本文整理汇总了Java中chatty.gui.components.Channel的典型用法代码示例。如果您正苦于以下问题:Java Channel类的具体用法?Java Channel怎么用?Java Channel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Channel类属于chatty.gui.components包,在下文中一共展示了Channel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hotkeyCommand

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Perform a command executed by a hotkey. This means that the channel
 * context is the currently active channel and the selected user name is
 * added as command parameter if present.
 *
 * @param command The name of the command, leading / is removed if necessary
 * @param parameter2 Additional parameter after the username
 * @param selectedUserRequired Whether the command should only be executed
 * if a user is currently selected
 */
private void hotkeyCommand(String command, String parameter2,
        boolean selectedUserRequired) {
    Channel channel = channels.getLastActiveChannel();
    User selectedUser = channel.getSelectedUser();
    if (selectedUserRequired && selectedUser == null) {
        return;
    }
    String selectedUserName = selectedUser != null ? selectedUser.getName() : "";
    if (command.startsWith("/")) {
        command = command.substring(1);
    }
    String parameter = null;
    if (!selectedUserName.isEmpty() || parameter2 != null) {
        parameter = selectedUserName+(parameter2 != null ? " "+parameter2 : "");
    }
    client.command(channels.getLastActiveChannel().getName(), command, parameter);
}
 
开发者ID:chatty,项目名称:chatty,代码行数:28,代码来源:MainGui.java

示例2: stateChanged

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * When the focus changes to a different channel (either by changing
 * a tab in the main window or changing focus to a different popout
 * dialog).
 *
 * @param e
 */
@Override
public void stateChanged(ChangeEvent e) {
    state.update(true);
    updateChannelInfoDialog(null);
    emotesDialog.updateStream(channels.getLastActiveChannel().getStreamName());
    moderationLog.setChannel(channels.getLastActiveChannel().getStreamName());
    autoModDialog.setChannel(channels.getLastActiveChannel().getStreamName());
    if (!openedFirstChannel
            && channels.getLastActiveChannel().getType() == Channel.Type.CHANNEL) {
        openedFirstChannel = true;
        if (adminDialog.isVisible()) {
            openChannelAdminDialog();
        }
        if (followerDialog.isVisible()) {
            openFollowerDialog();
        }
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:26,代码来源:MainGui.java

示例3: clearChat

import chatty.gui.components.Channel; //导入依赖的package包/类
public void clearChat(final String channel) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            Channel panel;
            if (channel == null) {
                panel = channels.getActiveChannel();
            } else {
                panel = channels.getChannel(channel);
                if (client.settings.listContains("streamChatChannels", channel)) {
                    streamChat.clear();
                }
            }
            if (panel != null) {
                panel.clearChat();
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:20,代码来源:MainGui.java

示例4: printLineAll

import chatty.gui.components.Channel; //导入依赖的package包/类
public void printLineAll(final String line) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            //client.chatLog.info(null, line);
            if (channels.getChannelCount() == 0) {
                Channel panel = channels.getActiveChannel();
                if (panel != null) {
                    printInfo(panel, line);
                }
                return;
            }
            for (Channel channel : channels.channels()) {
                printInfo(channel, line);
                client.chatLog.info(channel.getName(), line);
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:20,代码来源:MainGui.java

示例5: updateTitles

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Updates the titles of both the main window and popout dialogs.
 * 
 * @param state 
 */
private void updateTitles(int state) {
    // May be necessary to make the title either way, because it also
    // requests stream info
    String mainTitle = makeTitle(channels.getActiveTab(), state);
    String trayTooltip = makeTitle(channels.getLastActiveChannel(), state);
    trayIcon.setTooltipText(trayTooltip);
    if (client.settings.getBoolean("simpleTitle")) {
        setTitle("Chatty");
    } else {
        setTitle(mainTitle);
    }
    Map<Channel, JDialog> popoutChannels = channels.getPopoutChannels();
    for (Channel channel : popoutChannels.keySet()) {
        String title = makeTitle(channel, state);
        popoutChannels.get(channel).setTitle(title);
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:23,代码来源:MainGui.java

示例6: addChannel

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Adds a channel with the given name. If the default channel is still there
 * it is used for this channel and renamed.
 * 
 * @param channelName
 * @param type
 * @return 
 */
public Channel addChannel(String channelName, Channel.Type type) {
    if (channels.get(channelName) != null) {
        return null;
    }
    Channel panel;
    if (defaultChannel != null) {
        // Reuse default channel
        panel = defaultChannel;
        defaultChannel = null;
        panel.setName(channelName);
        panel.setType(type);
        channelChanged();
    }
    else {
        // No default channel, so create a new one
        panel = createChannel(channelName, type);
        tabs.addTab(panel);
        if (type != Channel.Type.WHISPER) {
            tabs.setSelectedComponent(panel);
        }
    }
    channels.put(channelName, panel);
    return panel;
}
 
开发者ID:chatty,项目名称:chatty,代码行数:33,代码来源:Channels.java

示例7: removeChannel

import chatty.gui.components.Channel; //导入依赖的package包/类
public void removeChannel(final String channelName) {
    Channel channel = channels.get(channelName);
    if (channel == null) {
        return;
    }
    channels.remove(channelName);
    closePopout(channel);
    tabs.removeTab(channel);
    channel.cleanUp();

    if (tabs.getTabCount() == 0) {
        if (dialogs.isEmpty() || !closeLastChannelPopout) {
            addDefaultChannel();
        } else {
            closePopout(dialogs.keySet().iterator().next());
        }
        lastActiveChannel = null;
        channelChanged();
        gui.updateState();
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:22,代码来源:Channels.java

示例8: hotkeyCommand

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Perform a command executed by a hotkey. This means that the channel
 * context is the currently active channel and the selected user name is
 * added as command parameter if present.
 *
 * @param command The name of the command, leading / is removed if necessary
 * @param parameter2 Additional parameter after the username
 * @param selectedUserRequired Whether the command should be executed if no
 * user is currently selected
 */
private void hotkeyCommand(String command, String parameter2,
        boolean selectedUserRequired) {
    Channel channel = channels.getLastActiveChannel();
    User selectedUser = channel.getSelectedUser();
    if (selectedUserRequired && selectedUser == null) {
        return;
    }
    String selectedUserName = selectedUser != null ? selectedUser.nick : "";
    if (command.startsWith("/")) {
        command = command.substring(1);
    }
    String parameter = null;
    if (!selectedUserName.isEmpty() || parameter2 != null) {
        parameter = selectedUserName+(parameter2 != null ? " "+parameter2 : "");
    }
    client.command(channels.getLastActiveChannel().getName(), command, parameter);
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:28,代码来源:MainGui.java

示例9: printLineAll

import chatty.gui.components.Channel; //导入依赖的package包/类
public void printLineAll(final String line) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            //client.chatLog.info(null, line);
            if (channels.getChannelCount() == 0) {
                Channel panel = channels.getActiveChannel();
                if (panel != null) {
                    panel.printLine(line);
                }
                return;
            }
            for (Channel channel : channels.channels()) {
                channel.printLine(line);
                client.chatLog.info(channel.getName(), line);
            }
        }
    });
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:20,代码来源:MainGui.java

示例10: addChannel

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Adds a channel with the given name. If the default channel is still there
 * it is used for this channel and renamed.
 * 
 * @param channelName
 * @return 
 */
public Channel addChannel(String channelName, int type) {
    if (channels.get(channelName) != null) {
        return null;
    }
    Channel panel;
    if (defaultChannel != null) {
        // Reuse default channel
        panel = defaultChannel;
        defaultChannel = null;
        panel.setName(channelName);
        channelChanged();
    }
    else {
        // No default channel, so create a new one
        panel = createChannel(channelName, type);
        tabs.addTab(panel);
        tabs.setSelectedComponent(panel);
    }
    channels.put(channelName, panel);
    return panel;
}
 
开发者ID:partouf,项目名称:Chatty-Twitch-Client,代码行数:29,代码来源:Channels.java

示例11: addChannel

import chatty.gui.components.Channel; //导入依赖的package包/类
/**
 * Adds a channel with the given name. If the default channel is still there
 * it is used for this channel and renamed.
 * 
 * @param channelName
 * @return 
 */
public Channel addChannel(String channelName) {
    if (channels.get(channelName) != null) {
        return null;
    }
    Channel panel;
    if (defaultChannel != null) {
        // Reuse default channel
        panel = defaultChannel;
        defaultChannel = null;
        panel.setName(channelName);
    }
    else {
        // No default channel, so create a new one
        panel = createChannel(channelName);
        tabs.addTab(panel);
        tabs.setSelectedComponent(panel);
    }
    channels.put(channelName, panel);
    return panel;
}
 
开发者ID:pokemane,项目名称:TwitchChatClient,代码行数:28,代码来源:Channels.java

示例12: openCurrentGame

import chatty.gui.components.Channel; //导入依赖的package包/类
public void openCurrentGame(Channel chan) {
    if (Helper.isRegularChannel(chan.getName())) {
        StreamInfo info = twitchApi.getStreamInfo(chan.getStreamName(), null);
        if (info.isValid() && !info.getGame().isEmpty()) {
            String game = info.getGame();
            UrlOpener.openUrl("http://speedrun.com/" + replaceForUrl(game));
            return;
        }
    }
    UrlOpener.openUrl("http://speedrun.com");
}
 
开发者ID:chatty,项目名称:chatty,代码行数:12,代码来源:Speedruncom.java

示例13: menuSelected

import chatty.gui.components.Channel; //导入依赖的package包/类
@Override
public void menuSelected(MenuEvent e) {
    if (e.getSource() == menu.srlStreams) {
        ArrayList<String> popoutStreams = new ArrayList<>();
        for (Channel channel : channels.getPopoutChannels().keySet()) {
            popoutStreams.add(channel.getStreamName());
        }
        menu.updateSrlStreams(channels.getActiveTab().getStreamName(), popoutStreams);
    } else if (e.getSource() == menu.view) {
        menu.updateCount(highlightedMessages.getNewCount(),
                highlightedMessages.getDisplayedCount(),
                ignoredMessages.getNewCount(),
                ignoredMessages.getDisplayedCount());
    }
}
 
开发者ID:chatty,项目名称:chatty,代码行数:16,代码来源:MainGui.java

示例14: testHotkey

import chatty.gui.components.Channel; //导入依赖的package包/类
public void testHotkey() {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            Channel panel = channels.getLastActiveChannel();
            if (panel != null) {
                panel.selectPreviousUser();
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:12,代码来源:MainGui.java

示例15: printLine

import chatty.gui.components.Channel; //导入依赖的package包/类
public void printLine(final String line) {
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            Channel panel = channels.getLastActiveChannel();
            if (panel != null) {
                printInfo(panel, line);
                client.chatLog.info(panel.getName(), line);
            }
        }
    });
}
 
开发者ID:chatty,项目名称:chatty,代码行数:13,代码来源:MainGui.java


注:本文中的chatty.gui.components.Channel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。