Really Need Some Help with CME 8.6 using IOS as Firewall and Anyconnect VPN on Phones
Hello,
I have a 2911 Router with IOS Security and Voice enabled and we are using CME 8.6. I am using a built-in Anyconnect VPN on 3 phones that are for remote users and thus I needed to enable security zones on the router which works because the remote phones will boot up, get their phone configs and I am able to call those remote phones from an outside line.
The issue I am having is that when I try to dial a remote phone connected via the VPN through port g0/0 from and internal office phone, i.e., NOT involving the PSTN then there is no audio. It's as if no audio is going back and forth. When I take off the security zones from the virtual-template interface and the g0/0 interface then the audio works great and I can reach the phone from internal as I am supposed to.
Could someone take a peek at my security config and see why audio would not be traveling through the VPN when I have my security zones turned on?
clock timezone PST -8 0
clock summer-time PST recurring
network-clock-participate wic 0
network-clock-select 1 T1 0/0/0
no ipv6 cef
ip source-route
ip cef
ip dhcp excluded-address 192.168.8.1 192.168.8.19
ip dhcp pool owhvoip
network 192.168.8.0 255.255.248.0
default-router 192.168.8.1
option 150 ip 192.168.8.1
lease 30
multilink bundle-name authenticated
isdn switch-type primary-ni
crypto pki server cme_root
database level complete
grant auto
lifetime certificate 7305
lifetime ca-certificate 7305
crypto pki token default removal timeout 0
crypto pki trustpoint cme_root
enrollment url http://192.168.8.1:80
revocation-check none
rsakeypair cme_root
crypto pki trustpoint cme_cert
enrollment url http://192.168.8.1:80
revocation-check none
crypto pki trustpoint TP-self-signed-2736782807
enrollment selfsigned
subject-name cn=IOS-Self-Signed-Certificate-2736782807
revocation-check none
rsakeypair TP-self-signed-2736782807
voice-card 0
dspfarm
dsp services dspfarm
voice service voip
allow-connections h323 to h323
allow-connections h323 to sip
allow-connections sip to h323
allow-connections sip to sip
fax protocol t38 version 0 ls-redundancy 0 hs-redundancy 0 fallback none
vpn-group 1
vpn-gateway 1 https://66.111.111.111/SSLVPNphone
vpn-trustpoint 1 trustpoint cme_cert leaf
vpn-profile 1
host-id-check disable
voice class codec 1
codec preference 1 g711ulaw
voice class custom-cptone jointone
dualtone conference
frequency 600 900
cadence 300 150 300 100 300 50
voice class custom-cptone leavetone
dualtone conference
frequency 400 800
cadence 400 50 200 50 200 50
voice translation-rule 1
rule 1 /9400/ /502/
rule 2 /9405/ /215/
rule 3 /9410/ /500/
voice translation-rule 2
rule 1 /.*/ /541999999/
voice translation-rule 100
rule 1 /^9/ // type any unknown plan any isdn
voice translation-profile Inbound_Calls_To_CUE
translate called 1
voice translation-profile InternationalType
translate called 100
voice translation-profile Local-CLID
translate calling 2
license udi pid CISCO2911/K9 sn FTX1641AHX3
hw-module pvdm 0/0
hw-module pvdm 0/1
hw-module sm 1
username routeradmin password 7 091649040910450B41
username cmeadmin privilege 15 password 7 03104803040E375F5E4D5D51
redundancy
controller T1 0/0/0
cablelength long 0db
pri-group timeslots 1-12,24
class-map type inspect match-any sslvpn
match protocol tcp
match protocol udp
match protocol icmp
class-map type inspect match-all router-access
match access-group name router-access
policy-map type inspect firewall-policy
class type inspect sslvpn
inspect
class class-default
drop
policy-map type inspect outside-to-router-policy
class type inspect router-access
inspect
class class-default
drop
zone security trusted
zone security internet
zone-pair security trusted-to-internet source trusted destination internet
service-policy type inspect firewall-policy
zone-pair security untrusted-to-trusted source internet destination trusted
service-policy type inspect outside-to-router-policy
interface Loopback0
ip address 192.168.17.1 255.255.248.0
interface Embedded-Service-Engine0/0
no ip address
shutdown
interface GigabitEthernet0/0
description Internet
ip address dhcp
no ip redirects
no ip proxy-arp
zone-member security internet
duplex auto
speed auto
interface GigabitEthernet0/1
ip address 192.168.8.1 255.255.248.0
duplex auto
speed auto
interface GigabitEthernet0/2
no ip address
shutdown
duplex auto
speed auto
interface Serial0/0/0:23
no ip address
encapsulation hdlc
isdn switch-type primary-ni
isdn incoming-voice voice
no cdp enable
interface Integrated-Service-Engine1/0
ip unnumbered Loopback0
service-module ip address 192.168.17.2 255.255.248.0
!Application: CUE Running on NME
service-module ip default-gateway 192.168.17.1
no keepalive
interface Virtual-Template1
ip unnumbered GigabitEthernet0/0
zone-member security trusted
ip local pool SSLVPNPhone_pool 192.168.9.1 192.168.9.5
ip forward-protocol nd
ip http server
ip http authentication local
no ip http secure-server
ip http path flash:/cme-gui-8.6.0
ip route 192.168.17.2 255.255.255.255 Integrated-Service-Engine1/0
ip access-list extended router-access
permit tcp any host 66.111.111.111 eq 443
tftp-server flash:apps31.9-3-1ES26.sbn
control-plane
voice-port 0/0/0:23
voice-port 0/3/0
voice-port 0/3/1
mgcp profile default
sccp local GigabitEthernet0/1
sccp ccm 192.168.8.1 identifier 1 priority 1 version 7.0
sccp
sccp ccm group 1
bind interface GigabitEthernet0/1
associate ccm 1 priority 1
associate profile 1 register CME-CONF
dspfarm profile 1 conference
codec g729br8
codec g729r8
codec g729abr8
codec g729ar8
codec g711alaw
codec g711ulaw
maximum sessions 4
associate application SCCP
dial-peer voice 500 voip
destination-pattern 5..
session protocol sipv2
session target ipv4:192.168.17.2
dtmf-relay sip-notify
codec g711ulaw
no vad
dial-peer voice 10 pots
description Incoming Calls To AA
translation-profile incoming Inbound_Calls_To_CUE
incoming called-number .
port 0/0/0:23
dial-peer voice 20 pots
description local 10 digit dialing
translation-profile outgoing Local-CLID
destination-pattern 9[2-9].........
incoming called-number .
port 0/0/0:23
forward-digits 10
dial-peer voice 30 pots
description long distance dialing
translation-profile outgoing Local-CLID
destination-pattern 91..........
incoming called-number .
port 0/0/0:23
forward-digits 11
dial-peer voice 40 pots
description 911
destination-pattern 911
port 0/0/0:23
forward-digits all
dial-peer voice 45 pots
description 9911
destination-pattern 9911
port 0/0/0:23
forward-digits 3
dial-peer voice 50 pots
description international dialing
translation-profile outgoing InternationalType
destination-pattern 9T
incoming called-number .
port 0/0/0:23
dial-peer voice 650 pots
huntstop
destination-pattern 650
fax rate disable
port 0/3/0
gatekeeper
shutdown
telephony-service
protocol mode ipv4
sdspfarm units 5
sdspfarm tag 1 CME-CONF
conference hardware
moh-file-buffer 90
no auto-reg-ephone
authentication credential cmeadmin tshbavsp$$4
max-ephones 50
max-dn 200
ip source-address 192.168.8.1 port 2000
service dnis dir-lookup
timeouts transfer-recall 30
system message Oregon's Wild Harvest
url services http://192.168.17.2/voiceview/common/login.do
url authentication http://192.168.8.1/CCMCIP/authenticate.asp
cnf-file location flash:
cnf-file perphone
load 7931 SCCP31.9-3-1SR4-1S.loads
load 7936 cmterm_7936.3-3-21-0.bin
load 7942 SCCP42.9-3-1SR4-1S.loads
load 7962 SCCP42.9-4-2-1S.loads
time-zone 5
time-format 24
voicemail 500
max-conferences 8 gain -6
call-park system application
call-forward pattern .T
moh moh.wav
web admin system name cmeadmin secret 5 $1$60ro$u.0r/cno/OD2JmtvPq4w9.
dn-webedit
transfer-digit-collect orig-call
transfer-system full-consult
transfer-pattern .T
fac standard
create cnf-files version-stamp Jan 01 2002 00:00:00
ephone-template 1
softkeys connected Hold Park Confrn Trnsfer Endcall ConfList TrnsfVM
button-layout 7931 2
ephone-template 2
softkeys idle Dnd Gpickup Pickup Mobility
softkeys connected Hold Park Confrn Mobility Trnsfer TrnsfVM
button-layout 7931 2
ephone-dn 1 dual-line
number 200
label Lisa
name Lisa Ziomkowsky
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 2 dual-line
number 201
label Dylan
name Dylan Elmer
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 3 dual-line
number 202
label Kimberly
name Kimberly Krueger
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 4 dual-line
number 203
label Randy
name Randy Buresh
mobility
snr calling-number local
snr 915035042317 delay 5 timeout 15 cfwd-noan 500
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 5 dual-line
number 204
label Mark
name Mark McBride
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 6 dual-line
number 205
label Susan
name Susan Sundin
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 7 dual-line
number 206
label Rebecca
name Rebecca Vaught
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 8 dual-line
number 207
label Ronnda
name Ronnda Daniels
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 9 dual-line
number 208
label Matthew
name Matthew Creswell
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 10 dual-line
number 209
label Nate
name Nate Couture
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 11 dual-line
number 210
label Sarah
name Sarah Smith
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 12 dual-line
number 211
label Janis
name Janis McFerren
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 13 dual-line
number 212
label Val
name Val McBride
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 14 dual-line
number 213
label Shorty
name Arlene Haugen
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 15 dual-line
number 214
label Ruta
name Ruta Wells
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 16 dual-line
number 215
label 5415489405
name OWH Sales
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 17 dual-line
number 216
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 18 dual-line
number 217
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 19 dual-line
number 218
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 20 dual-line
number 219
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 21 dual-line
number 220
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 22 dual-line
number 221
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 23 dual-line
number 222
label Pam
name Pam Buresh
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 24 dual-line
number 223
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 25 dual-line
number 224
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 26 dual-line
number 225
label Elaine
name Elaine Mahan
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 27 octo-line
number 250
label Shipping
name Shipping
ephone-dn 28 dual-line
number 251
label Eli
name Eli Nourse
call-forward busy 500
call-forward noan 500 timeout 10
ephone-dn 29 dual-line
number 252
ephone-dn 30 dual-line
number 253
ephone-dn 31 octo-line
number 100
label Customer Service
name Customer Service
call-forward busy 500
call-forward noan 500 timeout 12
ephone-dn 32 octo-line
number 101
label Sales
name Sales
call-forward busy 214
call-forward noan 214 timeout 12
ephone-dn 33 dual-line
number 260
label Conference Room
name Conference Room
call-forward busy 100
call-forward noan 100 timeout 12
ephone-dn 100
number 300
park-slot timeout 20 limit 2 recall
description Park Slot For All Company
ephone-dn 101
number 301
park-slot timeout 20 limit 2 recall
description Park Slot for All Company
ephone-dn 102
number 302
park-slot timeout 20 limit 2 recall
description Park Slot for All Company
ephone-dn 103
number 700
name All Company Paging
paging ip 239.1.1.10 port 2000
ephone-dn 104
number 8000...
mwi on
ephone-dn 105
number 8001...
mwi off
ephone-dn 106 octo-line
number A00
description ad-hoc conferencing
conference ad-hoc
ephone-dn 107 octo-line
number A01
description ad-hoc conferencing
conference ad-hoc
ephone-dn 108 octo-line
number A02
description ad-hoc conferencing
conference ad-hoc
ephone 1
device-security-mode none
mac-address 001F.CA34.88AE
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:2 2:31
ephone 2
device-security-mode none
mac-address 001F.CA34.8A03
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:12
ephone 3
device-security-mode none
mac-address 001F.CA34.898B
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
ephone 4
device-security-mode none
mac-address 001F.CA34.893F
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
ephone 5
device-security-mode none
mac-address 001F.CA34.8A71
ephone-template 1
max-calls-per-button 2
username "susan"
paging-dn 103
type 7931
button 1:6
ephone 6
device-security-mode none
mac-address 001F.CA34.8871
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:7 2:31 3:32
ephone 7
device-security-mode none
mac-address 001F.CA34.8998
ephone-template 1
max-calls-per-button 2
username "matthew"
paging-dn 103
type 7931
button 1:9
ephone 8
device-security-mode none
mac-address 001F.CA36.8787
ephone-template 1
max-calls-per-button 2
username "nate"
paging-dn 103
type 7931
button 1:10
ephone 9
device-security-mode none
mac-address 001F.CA34.8805
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:5
ephone 10
device-security-mode none
mac-address 001F.CA34.880C
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:14
ephone 11
device-security-mode none
mac-address 001F.CA34.8935
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:3
ephone 12
device-security-mode none
mac-address 001F.CA34.8995
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:8 2:31
ephone 13
device-security-mode none
mac-address 0021.5504.1796
ephone-template 2
max-calls-per-button 2
paging-dn 103
type 7931
button 1:4
ephone 14
device-security-mode none
mac-address 001F.CA34.88F7
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:23
ephone 15
device-security-mode none
mac-address 001F.CA34.8894
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:26
ephone 16
device-security-mode none
mac-address 001F.CA34.8869
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:28 2:27
ephone 17
device-security-mode none
mac-address 001F.CA34.885F
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:11
ephone 18
device-security-mode none
mac-address 001F.CA34.893C
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:27
ephone 19
device-security-mode none
mac-address 001F.CA34.8873
ephone-template 1
max-calls-per-button 2
paging-dn 103
type 7931
button 1:27
ephone 20
device-security-mode none
mac-address A456.3040.B7DD
paging-dn 103
type 7942
vpn-group 1
vpn-profile 1
button 1:13
ephone 21
device-security-mode none
mac-address A456.30BA.5474
paging-dn 103
type 7942
vpn-group 1
vpn-profile 1
button 1:15 2:16 3:32
ephone 22
device-security-mode none
mac-address A456.3040.B72E
paging-dn 103
type 7942
vpn-group 1
vpn-profile 1
button 1:1
ephone 23
device-security-mode none
mac-address 00E0.75F3.D1D9
paging-dn 103
type 7936
button 1:33
line con 0
line aux 0
line 2
no activation-character
no exec
transport preferred none
transport input all
transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
stopbits 1
line 67
no activation-character
no exec
transport preferred none
transport input all
transport output pad telnet rlogin lapb-ta mop udptn v120 ssh
line vty 0 4
transport input all
scheduler allocate 20000 1000
ntp master
ntp update-calendar
ntp server 216.228.192.69
webvpn gateway sslvpn_gw
ip address 66.111.111.111 port 443
ssl encryption 3des-sha1 aes-sha1
ssl trustpoint cme_cert
inservice
webvpn context sslvpn_context
ssl encryption 3des-sha1 aes-sha1
ssl authenticate verify all
policy group SSLVPNphone
functions svc-enabled
hide-url-bar
svc address-pool "SSLVPNPhone_pool" netmask 255.255.248.0
svc default-domain "bendbroadband.com"
virtual-template 1
default-group-policy SSLVPNphone
gateway sslvpn_gw domain SSLVPNphone
authentication certificate
ca trustpoint cme_root
inservice
end
I think your ACL could be the culprit.
ip access-list extended router-access
permit tcp any host 66.111.111.111 eq 443
Would you be able to change the entry to permit ip any any (just for testing purpose) and then test to see if the calls function properly. If they work fine then we know that we need to open som ports there.
Please remember to select a correct answer and rate helpful posts
Similar Messages
-
REALLY need some help with transparent background
This is really starting to bug me now as I have searched the forums and the web for hours and still cannot get this to work.
I am creating a simple one page site at http://freeselfhelpebooks.org/50ofTheBestPDProducts/
I want the header and footer image to have a transparent background with only the text showing, so that the text shows on the background image.
So far I have created the header image with a transparent background Modify > Canvas > Canvas Colour > Transparent all good so far. I have added some text. Then I save as file type PNG 32, however I still get the background as white as you can see above.
I have tried PNG 8 with alpha transparency, no transparency but to no avail. I have even downloaded Photoshop CS6 and have the same issues. What am I doing wrong here?First of all, your header graphic is fine; it's a transparent PNG. Your footer is a JPEG, which does not support transparency, so you need to resave that file into a different format (like PNG32, or PNG8 w/alpha transparency).
As I was trying to suggest, if you're confused about your graphics, check them in a graphics editor or viewer, not in a web page inside a web browser. Web development is a complex beast, and a lot can go wrong.
In the HTML of your web page, there is a class called "content" being applied to tables and images. This class has a background image being applied to it, which is responsible for the white background on those elements. -
I really need some help with rendering
I am creating a video for a client, and he is going to stream it through his own player. He requires the video to play using dimentions of 430 x 242.
He wants to keep the file sizes as small as possible.
I am currently creating his videos using a 1280 x 720 composition, as this is the same aspect ratio as his specific dimentions.
I am unsure of the best settings to use for the best quality. I've tried MOV but am getting files that are 600+ MB, and I'm also trying MPEG4 but getting blurry, washed out results that look nothing like the preview in AE. I've tried Flash and it stutters.
My questions:
1. Should I render in 1280 x 720 and just ask him to re-size them through his player? (I assume most players can do this?) or should I render to the dimensions of 430 x 242? He doesn't have too much knowledge of video.
2. What is the best file format and settings?
3. Is it possible to re-set the render option defaults? I've played around with all of the setting so much that I can't remember how each file format was set before I started this project. I've tried re-starting AE but it still leaves me with the same settings as when I closed it.
Every time I post a question like this I get people telling me to 'read the basics' or 'we get asked this time and time again etc'. Please note that I have a disability and am finding this very tough - if it isn't too much trouble I'd just appriciate someone giving the information so that I can learn in from here. It will need to be explained simply as yes I am fairly new to AE.
I just can't seem to find anything which works. MPEG4's are giving me a suitable file size but then look blurred and washed out.
Many thanks for any help.First question: What player is your client going to be using to play this? Everything depends on that. For example, if he's going to be playing the file using QuickTime Player, then the answer is pretty easy: create a QuickTime movie (.mov).
> Should I render in 1280 x 720 and just ask him to re-size them through his player?
No, not if you've been told that he wants a 430x242 file. If you make a big movie (in terms of frame dimensions) and have him resize it, then you're going to create much larger files than necessary.
> I am unsure of the best settings to use for the best quality. I've tried MOV but am getting files that are 600+ MB
The QuickTime movie (.mov) format is just a container format. It can contain video encoded using any of a large number of codecs, with any of a range of quality settings. The default is a lossless compression (using the Animation codec) that creates perfect images at the expense of larger files.
After you've added your composition to the render queue, choose QuickTime as your format in the Output Module Settings dialog box and then click the Format Options button in the Output Module Settings dialog box. You can choose a compression type, set quality, et cetera. People seem to like the H.264 codec for a good balance of size and quality.
See "Encoding and compression options for movies" for more information. -
REALLY need some help with my problem (Netgear and...
Hi everyone,
Well... where to start really.
This morning around 5am, I lost connection to the net, yet my Netgear (DG834 wired) showed an uptime of 117 hours, so it showed no reboot. It seems my IP profile was raised (As it was low before for my sync).
I had no reboot it seems, but my noise margin went up to 9db from 6db. This is fine as it means I should be getting around 6.5meg IP profile going by the sync. Anyway (This is complicated to explain but bear with me).
My current IP profile is now 7.15K. I know this will come down now to match my sync at 9db (Which should be 6.5meg).
What is happening, is that any change made to my broadband (Like my IP profile being raised this morning) means that I cannot then connect to the net, and anything connected (Like Xbox Live etc) disconnects, even though the router shows no disconnect, and all the lights are green.
The only way for me to reconnect to the internet then is to MANUALLY reboot the router, because no matter what website etc I try to view, it just says "Looking for..." in the bottom left corner of the browser, and I can't connect to anything like Xbox Live etc.
Can anyone explain why this is happening with the Netgear router? Shouldn't any change, like an IP profile increase not affect my broadband connection? It seems whenever a change is made BT side, I have to then manually reboot the router to get online.
I wondered if anyone with a netgear, or anyone with some knowledge on this could tell me why. This could save me a lot of headaches down the line and stop me having noise margin raised etc because I have to manually reboot the router to get it working again. I just thought that any change, like an increase in IP profile etc, shouldn't affect my connnection and force me to have to manually reboot the router to get it up and running again.
I hope you understood what I was trying to explain, and thanks in advance for any responses.Hi John. Thanks for responding.
I have been through the options on the router and can't find one that says auto connect at all.
It seems the router is not disconnecting though (Like this morning when the IP profile raised), as the uptime on both WAN and LAN were showing 117 hours, and all green lights were on, on the router. It's just when a change on the BT side is made, it won't let me get on the net until I do a manual reboot. It's all very baffling to me really.
I tried googling my problem to no avail also. -
Really need some help with this low earpiece volume issue.
I'm taking my iPhone to an Apple Store Genius tomorrow to check out the low volume in the earpiece. Has anyone else taken their phone in to an Apple Store and had the issue addressed? Are Geniuses just saying it is within spec? Has Apple published an article on this?
I realize that people are also frustrated over the low speakerphone volume, but the low volume in the earpiece is particularly concerning.
While traveling down the road it is very difficult to hear the person on the other end of the phone when using just the earpiece (no earbuds, no BT headset). The volume while using the earbuds is plenty loud.
Can anyone please shed some new light on this? I have had my iPhone for one week and I've got a bad feeling in my gut that this is a hardware issue and the earpiece speaker can't go any louder. Bummer.
(Obviously, all of my volume settings are maxed out).
-JoeWhen the iPhones were first released, some people reported on their posts that they were able to take them to the Genius Bar, have a tech test it out, the tech would agree that the volume sounded low, and get their phone swapped right away. Unfortunately, there is no cut and dry answer because people have reported all sorts of different things- that the various software updates have fixed their volume, messing with the volume setting within iTunes, etc.
Personally, I think it is a software glitch. Why? I did this: I was playing the iPod without the earbuds and the volume was only set midrange. I covered the speaker on the bottom, cranked up the volume, and the sound coming out of the receiver was MUCH louder than it ever is when I am using the iPhone on a call. That to me indicates that the low volume it just a glitch that can be fixed, because it CAN obviously sound louder, just within a different function. Hope that makes sense.
Good luck tomorrow. -
I need some help with my java game using applets, CAN SOMEBODY PLEASE HELP
Hi,
I am in the process of creating a RPG program using Java. I am not very experienced with java, however the problem i am currently facing is something i can't seem to figure out. I would like to draw a simple grid where a character (indicated by a filled circle) moves around this grid collecting items (indicated by a red rectangle). When the character moves on top of the grid with the item, i would like it to disappear. Right now i am not worrying about the fact that the item will reappear after the character moves away again, because sometimes, when the character moves over the item, nothing happens/another item disappears. i have been at this for 4 days and still cannot figure out what is goign on. can somebody please help me? it would be most appreciated.
Thanks
PS if i needed to send you my code, how do i do it?Thank you for replying.
The thing is, I am taking java as a course, and it is necessary for me to start off this way (this is for my summative evaluation). i agree with you on the fact, however, that i should go in small steps. i have been doing that until this point, and my frustration caused me to jump around randomly for an answer. I also think that it may just be a bug, but i have no clue as to how to fix it, as i need to show my teacher at least a part of what i was doing by sometime next week. Here is my code for anybody willing to go through it:
// The "Keys3" class.
import java.applet.*;
import java.awt.*;
import java.awt.Event;
import java.awt.Font;
import java.awt.Color;
import java.applet.AudioClip;
public class Keys3 extends java.applet.Applet
char currkey;
int currx, curry, yint, xint;
int itmval [] = new int [5],
locval [] = new int [5],
tempx [] = new int [5], tempy [] = new int [5],
tot = 0, score = 0;
boolean check = true;
AudioClip bgSound, bgSound2;
AudioClip hit;
private Image offscreenImage;
private Graphics offscreen; //initializing variables for double buffering
public void init () //DONE
bgSound = getAudioClip (getCodeBase (), "sound2_works.au");
hit = getAudioClip (getCodeBase (), "ah_works.au");
if (bgSound != null)
bgSound.loop ();
currx = 162;
curry = 68;
setBackground (Color.white);
for (int count = 0 ; count < 5 ; count++)
itmval [count] = (int) (Math.random () * 5) + 1;
locval [count] = (int) (Math.random () * 25) + 1;
requestFocus ();
public void paint (Graphics g) //DONE
resize (350, 270);
drawgrid (g);
if (check = true)
pickitems (g);
drawitems (g);
g.setColor (Color.darkGray);
g.fillOval (currx, curry, 25, 25);
if (currkey != 0)
g.setColor (Color.darkGray);
g.fillOval (currx, curry, 25, 25);
if (collcheck () != true)
collision (g);
else
drawitems (g);
} // paint method
public void update (Graphics g) //uses the double buffering method to overwrite the original
//screen with another copy to reduce flickering
if (offscreenImage == null)
offscreenImage = createImage (this.getSize ().width, this.getSize ().height);
offscreen = offscreenImage.getGraphics ();
} //what to do if there is no offscreenImage copy of the original screen
//draws the backgroudn colour of the offscreen
offscreen.setColor (getBackground ());
offscreen.fillRect (0, 0, this.getSize ().width, this.getSize ().height);
//draws the foreground colour of the offscreen
offscreen.setColor (getForeground ());
paint (offscreen);
//draws the offscreen image onto the main screen
g.drawImage (offscreenImage, 0, 0, this);
public boolean keyDown (Event evt, int key) //DONE
switch (key)
case Event.DOWN:
curry += 46;
if (curry >= 252)
curry -= 46;
if (hit != null)
hit.play ();
break;
case Event.UP:
curry -= 46;
if (curry <= 0)
curry += 46;
if (hit != null)
hit.play ();
break;
case Event.LEFT:
currx -= 66;
if (currx <= 0)
currx += 66;
if (hit != null)
hit.play ();
break;
case Event.RIGHT:
currx += 66;
if (currx >= 360)
currx -= 66;
if (hit != null)
hit.play ();
break;
default:
currkey = (char) key;
repaint ();
return true;
public boolean collcheck () //DONE
if (((currx == tempx [0]) && (curry == tempy [0])) || ((currx == tempx [1]) && (curry == tempy [1])) || ((currx == tempx [2]) && (curry == tempy [2])) || ((currx == tempx [3]) && (curry == tempy [3])) || ((currx == tempx [4]) && (curry == tempy [4])))
return false;
else
return true;
public void collision (Graphics g)
drawgrid (g);
for (int count = 0 ; count < 5 ; count++)
if ((currx == tempx [count]) && (curry == tempy [count]))
g.setColor (Color.darkGray);
g.fillOval (currx, curry, 25, 25);
else if ((currx != tempx [count]) && (curry != tempy [count]))
g.setColor (Color.red);
g.fillRect (tempx [count], tempy [count], 25, 25);
public void drawitems (Graphics g)
for (int count = 0 ; count < 5 ; count++)
g.setColor (Color.red);
g.fillRect (tempx [count], tempy [count], 25, 25);
public void pickitems (Graphics g)
check = false;
for (int count = 0 ; count < 5 ; count++)
if (locval [count] <= 5)
tempy [count] = 22;
else if (locval [count] <= 10)
tempy [count] = 68;
else if (locval [count] <= 15)
tempy [count] = 114;
else if (locval [count] <= 20)
tempy [count] = 160;
else if (locval [count] <= 25)
tempy [count] = 206; //this determines the y-position of the item to be placed
if (locval [count] % 5 == 0)
tempx [count] = 294;
else if ((locval [count] == 1) || (locval [count] == 6) || (locval [count] == 11) || (locval [count] == 16) || (locval [count] == 21))
tempx [count] = 30;
else if ((locval [count] == 2) || (locval [count] == 7) || (locval [count] == 12) || (locval [count] == 17) || (locval [count] == 22))
tempx [count] = 96;
else if ((locval [count] == 3) || (locval [count] == 8) || (locval [count] == 13) || (locval [count] == 18) || (locval [count] == 23))
tempx [count] = 162;
else if ((locval [count] == 4) || (locval [count] == 9) || (locval [count] == 14) || (locval [count] == 19) || (locval [count] == 24))
tempx [count] = 228;
public void drawgrid (Graphics g) //DONE
g.drawRect (10, 10, 330, 230); //draws the outer rectangular border
int wi = 10; //width of one square on the board
int hi = 10; //height of one square on the board
for (int height = 1 ; height <= 5 ; height++)
for (int row = 1 ; row <= 5 ; row++)
if (((height % 2 == 1) && (row % 2 == 1)) || ((height % 2 == 0) && (row % 2 == 0)))
g.setColor (Color.gray);
g.fillRect (wi, hi, 66, 46);
else /*if (((height % 2 == 0) && (row % 2 == 1)) || ((height % 2 == 0) && (row % 2 == 0)))*/
g.setColor (Color.lightGray);
g.drawRect (wi, hi, 66, 46);
g.setColor (Color.lightGray);
g.drawRect (wi, hi, 66, 46); //drawn twice to make a shadow effect
wi += 66;
wi = 10;
hi += 46;
} //this draws the basic outline of the game screen
} // Keys3 class -
Need some help with threads...
Hello all,
I am working on a project at work, and I am not the best programmer in the world. I have been trying to get my head around this for a couple of days and just cannot get it to work.
I am writing an instrumentation control program that will have three threads. One is the GUI, one will receive control information and set up the hardware, and one will check the hardware status and report it to the GUI periodically. I plan on using the invokeLater() method to communicate the status to the GUI and change the status display in the GUI. Communication from the GUI to the controller thread and from the status thread to the controller thread I had planned on being piped input/output stream as appropriate. I have a control class and a status class that need to be communicated over these piped streams. In some trial code I have been unable to wrap the piped input/output streams with object input/output streams. I really need some help with this. Here is the main thread code:
package playingwiththreads1;
import java.io.*;*
*public class PlayingWithThreads1 {*
public static void main(String[] args) {*
* PipedOutputStream outputPipe = new PipedOutputStream();*
* ObjectOutputStream oos = null;*
* ReceiverThread rt = new ReceiverThread(outputPipe);*
// Start the thread -- First try*
* Thread t = new Thread(rt);*
t.start();*
// Wrap the output pipe with an ObjectOutputStream*
try*
oos = new ObjectOutputStream(outputPipe);*
catch (IOException e)*
System.out.println(e);*
// Start the thread -- Second try*
//Thread t = new Thread(rt);*
//t.start();*
/** Send an object over the pipe. In reality this object will be a
class that contains control or status information */
try
if (!oos.equals(null))
oos.writeObject(new String ("Test"));
catch (IOException e)
try
Thread.sleep(5000);
catch (InterruptedException e)
I read somewhere that it matters where you start the thread relative to where you wrap piped streams with the object streams. So, I tried the two places I felt were obvious to start the thread. These are noted in the comments. Here is the code for the thread.
package playingwiththreads1;
import java.io.*;
public class ReceiverThread implements Runnable {
private PipedInputStream inputPipe = new PipedInputStream();
private ObjectInputStream inputObject;
ReceiverThread (PipedOutputStream outputPipe)
System.out.println("Thread initialization - start");
try
inputPipe.connect(outputPipe);
inputObject = new ObjectInputStream(inputPipe);
catch (IOException e)
System.out.println(e);
System.out.println("Thread initialization - complete");
public void run()
System.out.println("Thread started");
try
if (inputObject.available() > 0)
System.out.println(inputObject.read());
catch (IOException e)
System.out.println(e);
Through testing I have determined that no matter where I start the thread, the thread never gets past the "inputObject = new ObjectInputStream(inputPipe);" assignment.
Could someone please help me with this? There are other ways for me to write this program, but this is the one that I would like to make work.
Many thanks in advance,
Rob Hix
Edited by: RobertHix on Oct 6, 2009 3:54 AMThanks for the help, but that did not work. I tried flushing the ObjectOutputStream and it is still hanging when initializing the thread.
Here is a better look at the code since I was helped to figure out how to insert it:
The main method:
package playingwiththreads1;
import java.io.*;
public class PlayingWithThreads1 {
public static void main(String[] args) {
PipedOutputStream outputPipe = new PipedOutputStream();
ObjectOutputStream oos = null;
ReceiverThread rt = new ReceiverThread(outputPipe);
// Start the thread -- First try
//Thread t = new Thread(rt);
//t.start();
// Wrap the output pipe with an ObjectOutputStream
try
oos = new ObjectOutputStream(outputPipe);
oos.flush();
catch (IOException e)
System.out.println(e);
// Start the thread -- Second try
Thread t = new Thread(rt);
t.start();
/* Send an object over the pipe. In reality this object will be a
* class that contains control or status information */
try
if (!oos.equals(null))
oos.writeObject(new String ("Test"));
oos.flush();
catch (IOException e)
System.out.pringln(e);
try
Thread.sleep(5000);
catch (InterruptedException e)
}The thread code:
package playingwiththreads1;
import java.io.*;
public class ReceiverThread implements Runnable {
private PipedInputStream inputPipe = new PipedInputStream();
private ObjectInputStream inputObject;
ReceiverThread (PipedOutputStream outputPipe)
System.out.println("Thread initialization - start");
try
inputPipe.connect(outputPipe);
inputObject = new ObjectInputStream(inputPipe);
catch (IOException e)
System.out.println(e);
System.out.println("Thread initialization - complete");
public void run()
System.out.println("Thread started");
try
if (inputObject.available() > 0)
System.out.println(inputObject.read());
catch (IOException e)
System.out.println(e);
}Does anyone else have and ideas? -
Need some help with ".png" image.
Good day everyone. Here's the run down. I need to add an
image (image "A") ontop of another image (image"B"). Image "B" is a
paterned background. And Image "A" a logo with a transparent
background.
As it stands I have image "A" as a "png" and as you know....
they are fri**ing huge! Haveing it as a "gif" only presents me with
the IE6 problem of it adding a colored background to the image.
So I'm stuck! Can any one tell me or point me in the
difection of a tutorial to tell me the best way to add an image
with a transparent background in Dreamweaver.
Really need some help with this!
Thanks all!>Right you can see the work in progress here>
http://www.stclairecreative.com/DoughBoys_Site_Folder/home.html
Before going much further I'd recommend reconsidering the use
of a textured background. They are usually included for the benefit
of the site owner only, and likely to annoy visitors. Studies on
the subject suggest they often lead to usability problems. I do
like to header graphic, but at 200K it's kinda heavy and can
probably be optimized. -
Error 1603: Need some help with this one
When installing iTunes I first get an error box saying
"Error 1406: Could not write value to key \Software\classes\.cdda\OpenWithList\iTunes.exe. Verify that you have sufficient access to that key, or contact your support personnel."
The second one (after I click on Ignore on the last box) I get it this one:
"Error: -1603 Fatal error during installation.
Consult Windows Installer Help (Msi.chm) or MSDN for more information"
Strange thing is that I do have full access to my computer (or atleast in all other cases I have had since I am the only one with an account on it).
I have done my best in trying to solve it myself but I'm running out of ideas. I have downloaded latest versions from the website and tried installing Quicktime separately. I have also tried removing Quicktime using add/or remove programs though I just I didn't dare to take full removal because it said something about system files.
Anyway I really need some help with this, anyone got any ideas?
Greets,
Sixten
Windows XP ProDo you know how to count backwards? Do you know how to construct a loop? Do you know what an autodecrementor is? Do you know how to use String length? Do you know Java arrays start with index 0 and run to length-1? Do you know you use length on arrays too? Do you know what System.out.println does?
Show us what you have, there isn't anything here that isn't easily done the same as it would be on paper. -
Need some help with social net site
I need to create a site with editable user profiles, the site
will feature sports stats that the user can update.
I use Dreamweaver and MYSQL but I need some direction. Im
starting from scratch here, are there any templates or free source
code to go off of? I really need some help!!"Funks Da Burn" <[email protected]> wrote in
message
news:g1np74$eej$[email protected]..
>I need to create a site with editable user profiles, the
site will feature
> sports stats that the user can update.
> I use Dreamweaver and MYSQL but I need some direction.
Im starting from
> scratch here, are there any templates or free source
code to go off of? I
> really need some help!!
That's not something you can do using templates or by
dropping in a free
script; it's pretty complicated. You need to know how to
design a database
and write server-side code. Dreamweaver will help you write
the code, but
you still need to plan and design the whole application. I'd
recommend
starting with a book. It sounds like PHP is going to be your
best bet - does
your host server support it? If so, do a search on Amazon.com
for books on
Dreamweaver and PHP, and/or ask for recommendations here.
Patty Ayers | www.WebDevBiz.com
Free Articles on the Business of Web Development
Web Design Contract, Estimate Request Form, Estimate
Worksheet -
Need some help with guitar setup...
jeez, never thought i'd be asking a question like this after playing for like 20 years, but i need some help with a guitar setup for mac. i'm gonna list out a lot of crap here that prolly doesn't affect anything at all, but here goes.
Imac 17inch G4 - latest updated OS X... 10.4, or 5, or whatever. garageband 3.0
digitech gnx-3
alesis sr-16
sure mic's
yamaha e203 keyboard
here's the setup:
yamaha is on its own on a usb uno midi interface, sure's connected to gnx's xlr port, alesis connected to gnx's jam-a-long input, '87 kramer vanguard connected to gnx's guitar input. currently running headphones out on gnx to line in on mac.
here's the problem:
everything works beautifully, but my guitar sounds like crap. if i plug headphones into the gnx, it sounds beautiful. that makes me think its some kind of level issue between the gnx's output, and the mac's input, but nothing seems to fix it.
by sounding like crap, i mean way too much bass. sound is muddy, blurry, not crisp... aka crap. i've tried altering both output and input on mac and gnx, and i cant get a combination that works. the gnx has a s/pdif out, can the mac accept that as input? might that help? short of running the gnx to my marshal half stack and mic'ing that, anyone have any suggestions, or use a similar setup?
any help would be greatly appreciated!anyone? ... any suggestions? I think it might be an issue with the gnx pre-amping the signal as it goes out, and then the mac amping it on the way in, giving me a buttload more signal than i need, but since i cant find a happy level, i'm not really sure. i really dont want to resort to mic'ing my marshall... even with the volume almost off, my jcm900 is WAY too loud for apartment use. its not like i really NEED the guitar to sound perfect, i only use garageband to sketch out ideas for songs between myself and bandmates, but its really annoying to not have my customary crisp distortion. my bass player keeps telling me to use the built in amps, but, not to dis a practically free program, but the built in amps blow, at least after 10 years of marshall tube amplification they do. if anyone has any suggestions that might be helpfull on how i might resolve this, i would be your best friend for life and go to all your birthday parties
-
Need some help with sound quality
Hi guys, new here. I'm working on creating an album on my own. Bass and vocals are real, everything else is using software instruments. I have about 8 songs done, but the problem is I don't really know what I'm doing as far as recording and levels go.
I'm using studio headphones and everything sounds fantastic through them, and even pretty good if I just hook up some earbuds, but when I bounce out a track and burn them to do a disc and play it in my car, it sounds awful. Suddenly the guitar is too low, drums are too loud.
I really need some help here. I'm even willing to pay someone to get me on the right track. Using paypal or whatever.AecDuck wrote:
Where's the fun in that? Maybe you have different motives, but I got into home recording because I like doing things myself, even if I have to learn the hard way. If you know enough to get good bass and vocal recordings and mix that with virtual instruments, then you are well on your way to making a decent sounding mix. Mixing in headphones can be very deceiving. Things simply sound different in headphones. You need some monitors, even if they are crappy because if you can get it to sound good in crappy monitors it will likely sound good on other speakers.
The fun and experience comes from getting a good balance that sounds good in headphones, and in the monitors, and in your home stereo, and in your car stereo. Use the different audio systems as a reference. If the drums are too quiet in the car, bring them up a bit. If the bass is too loud in your headphones, put them down a bit.
If you bring in your recordings to be mixed by somebody else, first of all you're going to end up paying hundreds, if not $1000+ dollars, even in a sub-par studio. Secondly, it's never going to sound how you want it to sound. It's going to sound how THEY want it to sound.
I know it takes longer, and it's hard work, but you will have such a tremendous amount of satisfaction when your project is done knowing that YOU recording it, and YOU mixed it on YOUR equipment. It will be 100% yours.
Where's the fun? How about the fun in interacting with another human being? How about the satisfaction in having another validate what you've been trying to produce?
I don't think it's helpful to make generalizations about what type of experience the OP might have in getting professional help. I have had good experiences working with mixing engineers, and perhaps I have just been lucky, but I've been able to produce music that sounded how I wanted it to sound, but at a level beyond which my skill at the time would have been able to produce, AND I gained some insights to help me in the future.
It IS satisfying to teach yourself a new skill. And it takes a lot of patience, trial and error, and you might miss the mark more often than you hit it. If you're in a rush, it might be a viable solution to contact some studios and see if you can work with them. Learning from others is perfectly acceptable. -
hi all
i am writing a simple program and got stuck at one point
this is how it goes:
public static static main(String[] a) {
for (int i=1; i<a.length; i++){
System.out.print(a[i]+",");
so if i entered "a ab abc" this becomes "a,ab,abc,"
the problem is that i NEED to use substring to get rid of the last comma, how can i take the already print out result as a whole new string?? or i need to rewrite it in another way??
i really need some help, thanks in advance
BYou start from index 1, skipping the first element in the a-array, is that what you want? Otherwise you should loop from 0.
Anyway, here is how you can do it (skipping first element as you did):
for (int x = 1; x < a.length; x++) {
System.out.print(a[x]);
if (x < a.length-1)
System.out.print(",");
}You can't remove what you have already printed out. Another way to do this, is with a StringBuffer:
StringBuffer sb = new StringBuffer();
for (int x = 1; x < a.length; x++) {
sb.append(a[x]);
if (x < a.length-1)
sb.append(",");
String s = sb.toString();
System.out.println(s); -
Help request - Could need some help with a logo for my site
Hi I'm working on a project and i have come across a huge problem.
please check out my logo on this site:
http://www.tuxxen.com
I have no idea how i should make my logo and it seems like i have no skills to make one either, i have been trying for days to make one that look decent but it end up looking really really bad each time.
Could really need some help to get a nice logo up, the site im working on is about fishing, the name of this site will be changed to: Absolut mete. So the logo need to have this name.
I have managed to make the layout for my site but i cannot make a logo its a bit funny really but yeah...
Any help are very much welcome!THANK YOU/___sbsstatic___/migration-images/migration-img-not-avail.png so the tolerance makes it not care so much about the gradations in color? what else is tolerence good for?
I have a cleaner copy now after someone suggested GIMP, so played with it last night - though couldn't figure out transparency - that was clear on converter- just not cooperative till these wonderful directions.
So now I know how to do it without messing with the pic, and with messing with it - both good lessons and got a bit brighter color out of the deal.
many thanks for the straightforward and clear directions, they worked perfectly/___sbsstatic___/migration-images/migration-img-not-avail.png extra strars for you/___sbsstatic___/migration-images/migration-img-not-avail.png -
Please I need some help with a table
Hi All
I need some help with a table.
My table needs to hold prices that the user can update.
Also has a total of the column.
my question is if the user adds in a new price how can i pick up the value they have just entered and then add it to the total which will be the last row in the table?
I have a loop that gets all the values of the column, so I can get the total but it is when the user adds in a new value that I need some help with.
I have tried using but as I need to set the toal with something like total
totalTable.setValueAt(total, totalTable.getRowCount()-1,1); I end up with an infinite loop.
Can any one please advise on some way I can get this to work ?
Thanks for reading
CraigHi there camickr
thanks for the help the other day
this is my full code....
package printing;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.swing.*;
import javax.swing.table.*;
import java.text.DecimalFormat;
public class tablePanel
extends JDialog implements Printable {
BorderLayout borderLayout1 = new BorderLayout();
private boolean printing = false;
private Dialog1 dialog;
JPanel jPanel = new JPanel();
JTable table;
JScrollPane scrollPane1 = new JScrollPane();
DefaultTableModel model;
private String[] columnNames = {
private Object[][] data;
private String selectTotal;
private double total;
public tablePanel(Dialog1 dp) {
dp = dialog;
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
public tablePanel() {
try {
jbInit();
catch (Exception exception) {
exception.printStackTrace();
private void jbInit() throws Exception {
jPanel.setLayout(borderLayout1);
scrollPane1.setBounds(new Rectangle(260, 168, 0, 0));
this.add(jPanel);
jPanel.add(scrollPane1, java.awt.BorderLayout.CENTER);
scrollPane1.getViewport().add(table);
jPanel.setOpaque(true);
newTable();
addToModel();
addRows();
setTotal();
public static void main(String[] args) {
tablePanel tablePanel = new tablePanel();
tablePanel.pack();
tablePanel.setVisible(true);
public void setTotal() {
total = 0;
int i = table.getRowCount();
for (i = 0; i < table.getRowCount(); i++) {
String name = (String) table.getValueAt(i, 1);
if (!"".equals(name)) {
if (i != table.getRowCount() - 1) {
double dt = Double.parseDouble(name);
total = total + dt;
String str = Double.toString(total);
table.setValueAt(str, table.getRowCount() - 1, 1);
super.repaint();
public void newTable() {
model = new DefaultTableModel(data, columnNames) {
table = new JTable() {
public Component prepareRenderer(TableCellRenderer renderer,
int row, int col) {
Component c = super.prepareRenderer(renderer, row, col);
if (printing) {
c.setBackground(getBackground());
else {
if (row % 2 == 1 && !isCellSelected(row, col)) {
c.setBackground(getBackground());
else {
c.setBackground(new Color(227, 239, 250));
if (isCellSelected(row, col)) {
c.setBackground(new Color(190, 220, 250));
return c;
table.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if (e.getClickCount() == 1) {
if (table.getSelectedColumn() == 1) {
table.setTableHeader(null);
table.setModel(model);
scrollPane1.getViewport().add(table);
table.getColumnModel().getColumn(1).setCellRenderer(new TableRenderDollar());
public void addToModel() {
Object[] data = {
"Price", "5800"};
model.addRow(data);
public void addRows() {
int rows = 20;
for (int i = 0; i < rows; i++) {
Object[] data = {
model.addRow(data);
public void printOut() {
PrinterJob pj = PrinterJob.getPrinterJob();
pj.setPrintable(tablePanel.this);
pj.printDialog();
try {
pj.print();
catch (Exception PrintException) {}
public int print(Graphics g, PageFormat pageFormat, int pageIndex) throws PrinterException {
Graphics2D g2 = (Graphics2D) g;
g2.setColor(Color.black);
int fontHeight = g2.getFontMetrics().getHeight();
int fontDesent = g2.getFontMetrics().getDescent();
//leave room for page number
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
double pageWidth = pageFormat.getImageableWidth();
double tableWidth = (double) table.getColumnModel().getTotalColumnWidth();
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
double headerHeightOnPage = 16.0;
//double headerHeightOnPage = table.getTableHeader().getHeight() * scale;
//System.out.println("this is the hedder heigth " + headerHeightOnPage);
double tableWidthOnPage = tableWidth * scale;
double oneRowHeight = (table.getRowHeight() + table.getRowMargin()) * scale;
int numRowsOnAPage = (int) ( (pageHeight - headerHeightOnPage) / oneRowHeight);
double pageHeightForTable = oneRowHeight *numRowsOnAPage;
int totalNumPages = (int) Math.ceil( ( (double) table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages) {
return NO_SUCH_PAGE;
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
//bottom center
g2.drawString("Page: " + (pageIndex + 1 + " of " + totalNumPages), (int) pageWidth / 2 - 35, (int) (pageHeight + fontHeight - fontDesent));
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex * pageHeightForTable);
//If this piece of the table is smaller
//than the size available,
//clip to the appropriate bounds.
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted =
numRowsOnAPage * pageIndex;
int numRowsLeft =
table.getRowCount()
- lastRowPrinted;
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(oneRowHeight *
numRowsLeft));
//else clip to the entire area available.
else {
g2.setClip(0,
(int) (pageHeightForTable * pageIndex),
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(pageHeightForTable));
g2.scale(scale, scale);
printing = true;
try {
table.paint(g2);
finally {
printing = false;
//tableView.paint(g2);
g2.scale(1 / scale, 1 / scale);
g2.translate(0f, pageIndex * pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,
(int) Math.ceil(tableWidthOnPage),
(int) Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
//table.getTableHeader().paint(g2);
//paint header at top
return Printable.PAGE_EXISTS;
class TableRenderDollar extends DefaultTableCellRenderer{
public Component getTableCellRendererComponent(
JTable table,
Object value,
boolean isSelected,
boolean isFocused,
int row, int column) {
setHorizontalAlignment(SwingConstants.RIGHT);
Component component = super.getTableCellRendererComponent(
table,
value,
isSelected,
isFocused,
row,
column);
if( value == null || value .equals("")){
( (JLabel) component).setText("");
}else{
double number = 0.0;
number = new Double(value.toString()).doubleValue();
DecimalFormat df = new DecimalFormat(",##0.00");
( (JLabel) component).setText(df.format(number));
return component;
}
Maybe you are looking for
-
Encountering a RunTime error when I try running from command prompt
When I try to load my class from the command prompt I get the error: Exception in thread "main" java.lang.NoClassDefFoundError: MiniTriangle Since this seems like a pretty basic error, I'm hoping there's a black and white solution to it. Unfortunatly
-
Is there a way to observe/control iOS devices like ARD for desktops/laptops?
For desktops/laptops I can use Apple Remote Desktop to monitor (and control) devices remotely. This is very useful for supporting users. I don't think there is such a thing for iOS devices, right? I do not mean VNC on an iOS device to observe/control
-
hi When i execute a form.fmb, i should not get the mdi window , only the canvas which i have placed my items should get displayed. is it possible? or...
-
is there anyway to read wmv3? as far as i know that was always the format that VLC and flip4mac and WMP for mac could not decode. I would like to be able to read that formet without bootcamp or parallels. I would also settle for a mac program that co
-
Big Issue with access applicationwise using SSO (windows AD)
Hello BO Guru's, I have one big issue. i will try to explain my scenario here in brief. Scenario Currently we have 3 application A,B & C in production and SSO is configured using windows AD auth application -> User group -> Access -> Win AD group A |